try you can use two controls one being winsocket or inet.
Here is winsock
Winsock1.Connect "www.google.com", 80
Private Sub Winsock1_Connect()
'Once the winsock has connected to the server we send our request.
'GET tells the server we are GETting the html
'the / just tells it to send the default page, usually index.html, .htm, .php or what have you.
'The HTTP/1.0 tells it that we are using HTTP version 1
'Then we let the server know it has the whole request by sending 2 vbCrLf's
Winsock1.SendData "GET / HTTP/1.0" & vbCrLf & vbCrLf
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
'Once the server starts returning data we need to handle it.
'As some pages can be large they will be returned in several packets.
'So we need a buffer to store all the packets in. So ....
Static buf As String
'Now we tell the Winsock to make the packet into a string called Wdata
Winsock1.GetData Wdata, vbString
'We add the packets to the buffer.
buf = buf & Wdata
'We need to check once all the html has arrived.
'So we check the buffer for the closing HTML tag.
'As some sites use capitals for tags and others use lowercase we use Lcase.
'This makes the buffer lowercase while we check it.
'If it's there we call the Parse Sub routine and pass the buffer to it.
If InStr(1, LCase(buf), "</html>") Then Parse (buf)
Private Sub Parse(Data As String)
'In here we are going to get the page title from the html.
'We them use the title for the forms caption.
'The integers a and b are used for finding the start and end of the title.
Dim a, b As Integer
'We no longer need the connection so we close winsock.
Winsock1.Close
'Now we find the title of the page.
'We make a = the start of the title by locating the <title> tag.
'We then add the length of the tag to it as the title starts
'at the end of the tag not the start.
a = InStr(1, LCase(Data), "<title>") + 7
'Then using a as the starting point we make b = the end of the title by locating </title>.
b = InStr(a, LCase(Data), "</title>")
'Now we make the title of the page the form's caption.
'The title is in the string called Data.
'It starts at a and it's length is b - a.
Form1.Caption = Mid(Data, a, b - a)
'Now we display all the returned data in our text box.
'The information at the start are the headers.
'These tell use the server type, the time and date on the server, etc.
Text1.Text = Data
End Sub
thats one way you can do that.
The other way is inet = Internet transfer control
test = Inet1.OpenURL("www.google.com")
Text1.Text = test
thats all the code.. much easer to use this.
Good luck hope this helps. |