Reading a remote URL using ASP ....
This piece of code can be used as an alternative method to reading a remote URL as described in another article on this site.
The advantage with this method is that it only uses ASP and does not use any components etc. It is also really simple.
<%
Response.Buffer = true
Dim objXMLHTTP, xml, text
Set xml = Server.CreateObject ("Microsoft.XMLHTTP")
'Or if this doesn't work then try :
'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open "GET", "http://www.webconcerns.co.uk/default.asp", false
xml.Send
text = xml.ResponseText
Response.write(text)
Set xml = Nothing
%>
Response.Buffer = true
Dim objXMLHTTP, xml, text
Set xml = Server.CreateObject ("Microsoft.XMLHTTP")
'Or if this doesn't work then try :
'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open "GET", "http://www.webconcerns.co.uk/default.asp", false
xml.Send
text = xml.ResponseText
Response.write(text)
Set xml = Nothing
%>
The remote URL is read into the variable 'text'. You can then do whatever you want with the text in your application, such as searching or displaying.
You may download this code by clicking here.
| Copyright © 2007 | Page updated July 2007 |