Jump to content

read the output source of an html file?


Recommended Posts

Hi all,i need to write the output html source of an ASP file into a div, that i can do using JS.but i first need to get the html output source and save it into a variable...any ideas on how can i pull that off?
If you need the HTML before processing the ASP, then you can read a text file stored on your server with a FileSystemObject:
<%Set fs=Server.CreateObject("Scripting.FileSystemObject")Set f=fs.OpenTextFile(Server.MapPath("some_file.asp"), 1)Response.Write(f.ReadAll)f.CloseSet f=NothingSet fs=Nothing%>

If you need the HTML after processing the ASP (I presume that's what you mean by "output source"), then you can read any web page with a an XMLHTTP object:

<%  Dim objXMLHTTP, xml  Set xml = Server.CreateObject("Microsoft.XMLHTTP")  xml.Open "GET", "http://www.somewebsite.com/"  xml.Send  Response.Write xml.responseText  Set xml = Nothing%>

Rather than response.writinging the data to the screen, you can save it in a variable and work with it some more.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...