Internet Transfer Control in VB6

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 12:45, 6 February 2008 by Admin (Talk | contribs)

Jump to: navigation, search

Using the OpenURL Method to Retrieve an HTML Page

Wses the internet transfer control with HTTP to create an HTML page.

Dim objInet as Inet Private Sub Form_Load() ' Set a reference to the internet transfer control. Set objInet = Me!axInetTran.Object End Sub Private Sub cmdWriteFile_Click() Dim b() as Byte ' Set the internet transfer control protocol and URL. objInet.Protocol = icHTTP objInet.URL = "HTTP://www.microsoft.com" ' Retrieve the HTML data into a byte array. b() = objInet.OpenURL(objInet.URL,icByteArray) ' Create a local file from the retrieved data. Open "C:\Homepage.htm" For Binary Access Write As #1 Put #1, , b() Close #1 MsgBox "Done" End Sub Private Sub cmdGetHeader_Click() ' Set the internet transfer control protocol and URL. objInet.Protocol = icHTTP objInet.URL = "HTTP://www.microsoft.com" ' Open the HTML and display the header information. objInet.openURL objInet.URL, icByteArray MsgBox objInet.GetHeader End Sub

 

FTP Files Using the Internet Transfer Control

You can easily FTP files between a client and host computer.

Port Service
21 File Transfer Protocol (FTP)
25 Simple Mail Transfer Protocol (SMTP)
79 Finger
80 Hypertext Transfer Protocol (HTTP)
443 Secure Hypertext Transfer Protocol (HTTPS)
666 DOOM multiplayer game port