Capturing a Page's HTML 
Author Message
 Capturing a Page's HTML

Hello-
Is there a way to capture the html code built from a asp page? In other
words, I need to use an asp page to create a html document that will be
stored in a database without sending it back to a browser.

Thanks-
Dennis S



Sun, 05 Oct 2003 02:50:44 GMT  
 Capturing a Page's HTML
set http = createobject("msxml2.XMLHTTP")
'===
'use ServerXMLHTTP (which requires XML 3.0) if executing on a server ...
'===
'set http = createobject("msxml2.ServerXMLHTTP")

sURL = "<a href='http://www.yahoo.com/default.htm"'>http://www.yahoo.com/default.htm"</a>
http.open "GET",sURL,false
http.send
sHtml = http.responsetext

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Hello-
> Is there a way to capture the html code built from a asp page? In other
> words, I need to use an asp page to create a html document that will be
> stored in a database without sending it back to a browser.

> Thanks-
> Dennis S



Mon, 06 Oct 2003 07:35:38 GMT  
 Capturing a Page's HTML
I did the same thing for a client, it worked-out pretty well, but the only
way I was able to do it effectively was by writing a COM object in C++.

I originally designed the COM to circumvent VBSripts horrible reallocation
performance.  Causing a string variant to grow by concatening it many times
with small pieces of text takes excruciating amounts of time.  I wrote it to
allocate a flat 64K, and defined a method to cat its argument to the buffer.
The buffer is accessible as a property, and another method flushes the
buffer contents straight to the browser response context.  When the length
of an arg plus the buffer length exceeds 64K, or when the object is
destroyed, it auto-flushes content to response.

This is all well and good, but it isn't any faster [or slower] than simply
using response.write with buffering turned on.  As such it was only useful
in cases where we wanted to build a big piece of content and act upon it as
a whole, but the auto-flush functionality forced calling code to jump
through too many hoops, trying to make sure output didn't exceed the limit.
Further, use of this object didn't mix well with response.write or inline
expressions.

It seemed useless.  Then I added a method to start "blob echo" mode, which
creates a record in an arg-specified table, and returns the identity field
value in the new record.  It then applies the same flush algorithm to
concatenate a blob field, either instead of, or in addition to the response
object.

It's actually possible to do on the client side, in an invisible DIV or
frame, and using remote scripting for db i/o, but it isn't fast, and it
forces the content to be sent over the wire to the client, then back again
to the server.

Good Luck,
Mark McGinty


Quote:
> Hello-
> Is there a way to capture the html code built from a asp page? In other
> words, I need to use an asp page to create a html document that will be
> stored in a database without sending it back to a browser.

> Thanks-
> Dennis S



Thu, 04 Dec 2003 18:17:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HelpMe!

2. Using server side ASP to capture and parse HTML pages from any URL

3. how can i lock my html page??'

4. HELP vbs capture of 'backspace'

5. David's HTML Tip 01 - Home Page and Favorites Anchor

6. 'Capturing' Error Messages

7. processing another page's HTML in a script

8. Capture result/output from 'run'-command

9. recherche d'un mot dans une page html

10. 'Capturing' Error Messages

11. File pdoxusrs.lck. Permission denied

12. Can you connect a Delphi 1.02 application to Oracle 7.3

 

 
Powered by phpBB® Forum Software