How would I be able to transmit data to the script as POST data or if there is a better way than that would be good too. Also I'd have to have a way to retrive the data sent back in reply from the script, be it Text or Binary.
Thanx
Printable View
How would I be able to transmit data to the script as POST data or if there is a better way than that would be good too. Also I'd have to have a way to retrive the data sent back in reply from the script, be it Text or Binary.
Thanx
You will nedd to use Winsock to do this. Once you have established a connection to the server on port 80 you can then send the POST request.
Unlike the GET method which encodes the variables and names in the URL query string, the POST method encodes them in the main body of the HTTP request. The best type of encoding to use is the one the use for GET, URL encoding. Each name/value pair is seperated by an ampersand and any meta characters are converted to their hexadecimal exquivilent in the form:
Space = 3210 = %20
Heres an article on how to do this in VB: http://www.freevbcode.com/ShowCode.asp?ID=1512
The HTTP itself would look something like this:
This tutorial shows how to use winsock to send an HTTP request. While this explains how to downlaod a file using the GET method, you can easily change it fit the the POST method. The only difference is, is the reponse from the server won't always be 200, they often send a 302 response which indicates the client should redirect to the URL in the location header.Code:POST /path/to/script.php HTTP/1.0\r\n
Content-Length:65\r\n
Content-Encoding: application/x-www-from-
urlencoded\r\n
\r\n
name=adam&age=21&occupation=student&hobbies[]=swim&hobbies[]=ring
http://www.vbip.com/winsock/winsock_http_01.asp