How to send POST data with Winsock in VB
I am trying to send POST data with Microsoft Winsock control but keep on receiving garbage from the webserver. Can anyone tell me the reason please? :)
What I send:
POST /search HTTP/1.1
Host: www.google.com
Content-Length: 30
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Connection: close
hl=en&q=sql+tutorial&btnG=Google+Search
What I get:
HTTP/1.1 501 Not Implemented
Connection: close
Content-Type: text/html
Server: GWS/2.1
Transfer-Encoding: chunked
Content-Encoding: gzip
Date: Mon, 23 Oct 2006 17:08:55 GMT
Cache-Control: private, x-gzip-ok=""
Re: How to send POST data with Winsock in VB
Re: How to send POST data with Winsock in VB
POst the code in its entirety that is how you built up the code and what method you used to send it via winsock??
Re: How to send POST data with Winsock in VB
Quote:
Originally Posted by litlewiki
POst the code in its entirety that is how you built up the code and what method you used to send it via winsock??
I used the same code as http://www.vbip.com/winsock/winsock_http_03_01.asp and tweaked it like the author said in http://www.vbip.com/forum/topic.asp?id=4
But it is not working as said.
Re: How to send POST data with Winsock in VB
I think a simple get request should work just follow the get example mentioned there.
Also take a look at the winsock sample by visualad in the codebank section
Code:
http://www.google.com/search?hl=en&q=sql**tutorial&btnG=Google+Search&meta=
is a sample get request btw
Re: How to send POST data with Winsock in VB
Quote:
Originally Posted by litlewiki
I think a simple get request should work just follow the get example mentioned there.
Also take a look at the winsock sample by visualad in the codebank section
Code:
http://www.google.com/search?hl=en&q=sql**tutorial&btnG=Google+Search&meta=
is a sample get request btw
Is there a sample code available anywhere which shows how to use Winsock to send POST data?
Re: How to send POST data with Winsock in VB
http://www.vbforums.com/showthread.p...hlight=winsock
dload the example ,build up your get data and see for yourself