Grab a page using XML

 

This function is used to grab an HTML page using Microsofts XMLHTTP component , using this component you can grab any page off the internet . Here is the code for this example

<%
Function GrabPage(strURL)
Dim objXML
Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET" , strURL , False ,"",""
objXML.Send
If Err.Number = 0 Then
If objXML.Status = 200 then
GrabPage = objXML.ResponseText
Else
GrabPage = "Incorrect URL"
End if
Else
GrabPage = Err.Description
End If
Set objXML = Nothing
End Function
%>

And you call the function like this

<%= GrabPage("http://asp.myscripting.com")

Here is an example that grabs the main page of the search engine Google . Get Google

Sponsors