Ripping Web Content Using MSXML
9/22/2004 8:18:32 AM
The classic ASP way of ripping Web content from an external site.
'function accepts a method, normally "GET", and the URL to grab. Function RipWebContent(Method, URL) 'On Error Resume Next Dim objXML Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP") 'The following properties of the method, user name and password is only for Basic Auth. 'objXML.Open Method, URL, False ,"UserName","Password" objXML.setTimeouts 5000,5000,15000,15000 objXML.Open "GET", URL, False ,"","" objXML.Send
If Err.Number = 0 Then 'and the url is valid If objXML.Status = 200 then 'store all of the downloaded data in strOpen RipWebContent = objXML.ResponseText Else RipWebContent = "Incorrect URL" End if Else RipWebContent = Err.Description End If Set objXML = Nothing End Function
|