OK... I have been trying my hardest to find someone in a forum on the internet who has vb.net code that fetches html via winsock. I would greatly appreciate ANYONE who could PLEASE convert this work in vb.net. And also a good explanation on how to start it using a buttonclick or formload.
Advance Thanks!
Ryan.
Code:Public Sub GetURL(strURL As String) ' function to fetch a web page Dim s As String Winsock1.RemoteHost = "p133"'my MS Personal Web Server Winsock1.RemotePort = 80 Winsock1.Connect End Function Private Sub Winsock1_Connect() ' comes here when TCP/IP connection is m ' ade ' now, send message to connection to get ' web page Dim strURL String Dim strMsg String strURL = "http://p133/DEFAULT.HTM" strMsg = "GET " + strURL + " HTTP/1.0" + vbCrLf strMsg = strMsg + "Accept: */*" + vbCrLf strMsg = strMsg + "Accept: text/html" + vbCrLf strMsg = strMsg + vbCrLf Winsock1.SendData strMsg End Sub Private Sub Winsock1_Close() ' comes here when remote server closes c ' onnection Winsock1.Close End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) 'comes here multiple times as data start ' s to arrive Dim rData As String Winsock1.GetData rData, vbString Text1.Text = Text1.Text + rData End Sub




Reply With Quote