Earth Skater Online Store Hosting
 

1 (877) 627-2492 Contact Us 

 
       
 
 

Microsoft XMLHTTP Control

Author: Staff
EarthSkater.net
This is a small example on using the Microsoft XMLHTTP Control

If you are reading this page then I shall assume that you already know a little bit about ASP and running ASP scripts.

Here is the ASP code to pull yahoo's html and output it on your page.  There are many potential uses for this code including screen scraping (pulling sections of another web site onto yours), and more.


<%

dim objXMLHTTP
dim URL

URL = "http://www.yahoo.com"   'the url that you want to pull html from

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")   'create the xmlhttp object
objXMLHTTP.Open "GET", URL, false   'use the open command to get the url
objXMLHTTP.Send

  'TO GET HEADERS
  'response.write objXMLHTTP.getAllResponseHeaders

Response.Write "<hr>"
Response.Write "<h4>HTML Code for&nbsp"&URL&"</h4>"
Response.Write "<textarea rows=30 cols=120>"
Response.Write objXMLHTTP.responseText    'output the html that was pulled from the page
Response.Write "</textarea>"

Set objXMLHTTP = Nothing

%>
 

 


Program Output:

msxml3.dll error '80070005'

Access is denied.

/asp/xmlhttp.asp, line 101