Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access a web site, then save the html or output to a text file

Status
Not open for further replies.

rickpro

Programmer
Sep 11, 2002
7
CA
How can I access a website from within vb code, and then save the html code or the output of the code to a text file. I ask because I amwriting a program to notify me when my external ip changes and I am going to access a website in a vb program that tells me what my ip is and then take out the ip part of the text file and mail my friends as well as gives me a message box. Does anyone know how I can put webpage into a text file? Thanks!
 
The following code will get the HTML of a web site into a string. Then you have several options for saving the string to a text file (richtextbox, open new file for output, etc.).

Add a Inet control to your form first.

Private Sub GetPage(strUrl As String)
Dim strWeb as String

If strUrl <> &quot;&quot; Then
Inet1.Cancel
Inet1.Protocol = icHTTP
Inet1.URL = strUrl
strWeb = Inet1.OpenURL(, icString)
End If

End Sub

Hope this helps.
 
Thanks for the info, I'll try that right away!

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top