key
Jun 12th, 2000, 11:21 AM
Anyone can tell me how to download a page using Winsock?
Also, how do I install Winsock? Where can I get it?
Thanks.
Crypt
Jun 12th, 2000, 09:43 PM
It depends what type vb u have if you have, if its a professional edition or enterprise edition then it comes with winsock control. Press ctrl+t when in vb then scroll down to Microsoft Winsock Control and check that box, and then add one to your form.
if you have a learning addition then go to
http://www.planet-source-code.com and search the vb section for winsock patch and you should find a download which will install and apply a registry patch so you can use it.
as for getting it to download a page its more difficult than inet controls, you have to connect to the webpage on port 80 and the send data to tell it to give you the page,
so in a command buttons click event you would have
winsock1.connect "http://www.whatever.com", 80
then in the winsock connection event, you'd send the data
Winsock1.SendData "GET " & "index.html" & " HTTP/1.0" & vbCrLf & vbCrLf
and then in the winsock data arrival event you'd have something like
dim whatever as string
winsock1.getdata whatever
text1.text = whatever
Now I am not sure if that will work for you as I am on a proxy server, and have to send the data to my proxy server to grab me the pages source. But it should work (I think) if I'm wrong can someone post here the correct way when not on a proxy server.