Difference between revisions of "Internet Transfer Control in VB6"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m
Line 1: Line 1:
 
== Using the OpenURL Method to Retrieve an HTML Page ==
 
== Using the OpenURL Method to Retrieve an HTML Page ==
  
Wses the internet transfer control with HTTP to create an HTML page.   
+
Uses the internet transfer control with HTTP to create an HTML page.   
 +
 
  
<nowiki>Dim objInet as Inet</nowiki>
 
<nowiki></nowiki>
 
<nowiki>Private Sub Form_Load()</nowiki>
 
<nowiki>  ' Set a reference to the internet transfer control.</nowiki>
 
<nowiki>  Set objInet = Me!axInetTran.Object</nowiki>
 
<nowiki>End Sub</nowiki>
 
<nowiki></nowiki>
 
<nowiki>Private Sub cmdWriteFile_Click()</nowiki>
 
<nowiki>  Dim b() as Byte</nowiki>
 
<nowiki></nowiki>
 
<nowiki>  ' Set the internet transfer control protocol and URL.</nowiki>
 
<nowiki>  objInet.Protocol = icHTTP</nowiki>
 
<nowiki>  objInet.URL = "HTTP://www.microsoft.com"</nowiki>
 
<nowiki></nowiki>
 
<nowiki>  ' Retrieve the HTML data into a byte array.</nowiki>
 
<nowiki>  b() = objInet.OpenURL(objInet.URL,icByteArray)</nowiki>
 
<nowiki></nowiki>
 
<nowiki>  ' Create a local file from the retrieved data.</nowiki>
 
<nowiki>  Open "C:\Homepage.htm" For Binary Access Write As #1</nowiki>
 
<nowiki>  Put #1, , b()</nowiki>
 
<nowiki>  Close #1</nowiki>
 
<nowiki></nowiki>
 
<nowiki>  MsgBox "Done"</nowiki>
 
<nowiki>End Sub</nowiki>
 
<nowiki></nowiki>
 
<nowiki>Private Sub cmdGetHeader_Click()</nowiki>
 
<nowiki>  ' Set the internet transfer control protocol and URL.</nowiki>
 
<nowiki>  objInet.Protocol = icHTTP</nowiki>
 
<nowiki>  objInet.URL = "HTTP://www.microsoft.com"</nowiki>
 
<nowiki></nowiki>
 
<nowiki>  ' Open the HTML and display the header information.</nowiki>
 
<nowiki>  objInet.openURL objInet.URL, icByteArray</nowiki>
 
<nowiki>  MsgBox objInet.GetHeader</nowiki>
 
<nowiki>End Sub</nowiki>
 
  
 
&nbsp;
 
&nbsp;

Revision as of 11:45, 6 February 2008

Using the OpenURL Method to Retrieve an HTML Page

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


 

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