Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving the contents of a webpage to a variable

Status
Not open for further replies.

DeltaTech

Programmer
Apr 16, 2003
92
MY
Hi All
Just wondering if instead of displaying a webpage, it's possible to store the contents of the page in a variable? I need to access a webpage outside my server which performs certain functions and depending on whether the operation was successful, returns a formatted web page.
I want to store that in a variable and depending on the content, reformat and display the page.
I know that in VB we can do this, but is this at all possible using ASP?
Thanks
[bigcheeks]
 
You can use XMLHTTP Object
Code:
<%
strURL = &quot;[URL unfurl="true"]http://www.tektips.com&quot;[/URL]
Set objXMLHTTP = Server.CreateObject(&quot;Msxml2.XMLHTTP.5.0&quot;)
objXMLHTTP.Open &quot;GET&quot;, strURL, false
objXMLHTTP.send  

lStrContent =  objXMLHTTP.responseText
Set objXMLHTTP = Nothing
%>

Now lStrContent contains the HTML response of that page.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top