-
Sending postdata to url
Hi
I want to send html form data to a URL with a C++ program. I've been trying to google something for the last 2 days, but found nothing. Maybe I'm a bad searcher. Could someone point me to the right direction by giving some links or advising on how to search?
Thanks
-
Pure WinInet...see HttpSendRequest.
-
I got a good tutorial on just that on my site. ;) You can get it here.
-
Very good tutorial, Queatrix.
However, I don't know how exactly should I send postdata.
Code:
char szPostData[ ] = "\0\0";
HttpSendRequest( hRequest, szNewHeader, strlen(szNewHeader),
szPostData, strlen(szPostData) );
What format should it be?
For example on this HTML form:
Code:
<form name="message" method="post" action="message.php">
<input name="subject" type="text">
Thanks again.
-
You have to know how the browser converts form data into a string, in this case szPostData should be:
Code:
char szPostData[ ] = "message=AAA&subject=BBB\0";
This is assuming "AAA" is what was 'typed' into the message edit box, and "BBB" is what was 'typed' in the subject edit line.
-
Oh, if it's as easy as sending the postdata from url, then thanks very much!