VB6 : HTTP Transfers

Created 08 January 2001 00:00
The MSXML2 Library contains the class ServerXMLHTTP30 which can be used to send HTTP requests and posts over the web.

Example 1: Executing an ASP page on a remote web server

  Dim objNetRequest As MSXML2.ServerXMLHTTP30
  Dim strURL As String
  strURL = "http://remote.com/YourPage.asp?param1=value1"
    
  Set objNetRequest = New MSXML2.ServerXMLHTTP30
  With objNetRequest
    .open "GET", strURL, False
    .send ("")
    MsgBox .responseText
  End With
  Set objNetRequest = Nothing

Example 2: Posting a form to a remote page
  Dim objNetRequest As MSXML2.ServerXMLHTTP30
  Dim strURL As String
  strURL = "http://remote.com/YourPage.asp?param1=value1"
    
  Set objNetRequest = New MSXML2.ServerXMLHTTP30
  With objNetRequest

    .open "POST", strURL, False
    .setRequestHeader "Content-Type", "text/xml"
    .send ("some text to be posted")
    MsgBox .responseText
  End With
  Set objNetRequest = Nothing