Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / HTTP POST with cURL, need quotemarks in string or other way to HTTP POST

Author
Message
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 3rd Feb 2015 19:37 Edited at: 3rd Feb 2015 21:33
I am trying to use a command line tool called cURL to post a http command. The command could look like this curl.exe -X POST "HTTP://site.nowhere.np". The problem is if I use EXECUTE FILE "curl.exe"," -X POST "HTTP://site.nowhere.np"","\",1 the quotemarks get messed up :-( I tried using IanM's MatrixUtil QUOTE$(string$) to encapsulate the HTTP string in quotemarks. Is there anyway to get those quotemarks in my string, or is there any other way to post a HTTP url command?

EDIT: I need quotemarks around the http address in the URL for cURL to accept it :-(

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 3rd Feb 2015 20:17
I also tried using chr$(34), just for info.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Feb 2015 00:14
Most languages have escape characters to allow quotes within quotes, I'm not sure that dbpro does though, I think I've run into this problem before

Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 4th Feb 2015 11:59 Edited at: 4th Feb 2015 12:00
I have solved my problem There was a problem with the directory I typed in EXECUTE FILE, it was "\" and should just be "" for calling the exe in the current work directory.

I use a HTTP command post to an SMS gateway so my chess server can send out SMS notifications when a player makes a move.

There was another problem, I can not use strings with spaces in them, they had to be replaced with %20 for the HTTP API I am using (this depends on the HTTP API, others use different codes for spaces). The username I used for testing had a space in it but now the server converts spaces to %20 Now I am waiting for my opponent to make a move =^_^=

EDIT: quote$(http_string$) from MatrixUtils1 encapsulates the string with extra quotemarks fine.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 4th Feb 2015 23:53
Good to know thanks!

Login to post a reply

Server time is: 2025-05-12 02:44:48
Your offset time is: 2025-05-12 02:44:48