Introduction
Today I needed to retrieve a HTML document not local to my website
from within an ASP application and display its content. I've written some time ago another
ActiveX component, but I wanted it this time without any components.
Therefore I used PerlScript that comes with ActivePerl
to write two small functions in Perl and use them from within normal (VBScript-)ASP.
Just two functions
The functions are called GetUrlContent(url) and GetUrlBody(url).
Both functions return the content of an arbitrary URL as a string. The first function returns
the whole content, whereas the second function returns only what is inside the <body>
-tags.
The usage of the functions is very easy, just call them with the URL you wisth to retrieve. E.g.
...
Response.Write GetUrlContent("http://www.codeproject.com/")
...
or
...
Response.Write GetUrlBody("http://www.codeproject.com/")
...
Installation
Beside the latest version of ActiveState's ActivePerl,
you need to download and install the libwww-perl
from cpan.org.