Simple way to send POST data? | developer.brewmp.com Simple way to send POST data? | developer.brewmp.com

Developer

Simple way to send POST data?

Forums:

Does anyone have a simple code snippet on how to send POST instead of GET? All I know is it's a lot of work compared to GET (which requires NO work)

if ((IPeek *)0 != pipPostData) // post information
{
IWEB_GetResponse(pIWeb,
(pIWeb, &piWResp, &cb, sActiveURL,
WEBOPT_HANDLERDATA, this,
WEBOPT_HEADER, "X-Method: POST\r\nContent-Type: application/x-www-form-urlencoded\r\n",
WEBOPT_HEADERHANDLER, Header,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pipPostData,
WEBOPT_CONTENTLENGTH, STRLEN(sPostData),
WEBOPT_USERAGENT, sHeader,
WEBOPT_END));
}

if ((IPeek *)0 != pipPostData) // post information
{
IWEB_GetResponse(pIWeb,
(pIWeb, &piWResp, &cb, sActiveURL,
WEBOPT_HANDLERDATA, this,
WEBOPT_HEADER, "X-Method: POST\r\nContent-Type: application/x-www-form-urlencoded\r\n",
WEBOPT_HEADERHANDLER, Header,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pipPostData,
WEBOPT_CONTENTLENGTH, STRLEN(sPostData),
WEBOPT_USERAGENT, sHeader,
WEBOPT_END));
}

Im sending just a few arguments to a PHP script, so what do I put in the body? And do I have to encode any of the url?
If I were doing a get method this would be my url:
http://www.something.com/download.php?language=en&platform=BREW
How do i make this into post data correctly? There are bits and pieces all over this forum but most of them have to do with sending actual data not just something like this.

Im sending just a few arguments to a PHP script, so what do I put in the body? And do I have to encode any of the url?
If I were doing a get method this would be my url:
http://www.something.com/download.php?language=en&platform=BREW
How do i make this into post data correctly? There are bits and pieces all over this forum but most of them have to do with sending actual data not just something like this.

GET method:
url = http://www.something.com/download.php?language=en&platform=BREW
POST method
url = http://www.something.com/download.php
sPost = "language=en&platform=BREW"
there is no question mark on the beginning of the post data
When sending post data there is no need to encode the data is sent.
Only encode the url as you do or not in GET method
try use this code to send post data to server and see if the data is transfered by printing it or saving it to a file on the server side

GET method:
url = http://www.something.com/download.php?language=en&platform=BREW
POST method
url = http://www.something.com/download.php
sPost = "language=en&platform=BREW"
there is no question mark on the beginning of the post data
When sending post data there is no need to encode the data is sent.
Only encode the url as you do or not in GET method
try use this code to send post data to server and see if the data is transfered by printing it or saving it to a file on the server side