Do i need to add any headers before making a post to server?
For example, Currently I'm trying to send a request along with the post data this way,
LPCWSTR post = L"name=User&subject=Hi&message=Hi";
if (!(WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0, (LPVOID)post, wcslen(post),
wcslen(post), 0)))
{
//error
}
should this work?
LPSTR post = "log=test";//in my php file: if(isset($_POST['log']))
hRequest = WinHttpOpenRequest(hConnect,
L"POST",
L"/test.php",
NULL,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
0);
bResults = WinHttpSendRequest(hRequest,
L"content-type:application/x-www-form-urlencoded",
-1,
post,
strlen(post),
strlen(post),
NULL);
I'd guess
\r\n
to your (narrow) string - I don't know if the API's going to add one since I assume you'd make the same call for binary data.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With