Click here to Skip to main content
14,972,394 members
Articles / Web Development / IIS
Article
Posted 22 Jul 2001

Stats

55.5K views
716 downloads
6 bookmarked

Retrieve an HTML Page from Within Your (ASP-)Scripts Without Any Components

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
28 Aug 2001CPOL
Tiny little Perl library to retrieve an arbitrary URL as a string

Introduction

Today, I needed to retrieve an 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 wish to retrieve. E.g.

PERL
...
Response.Write GetUrlContent("http://www.codeproject.com/")
...

or:

PERL
...
Response.Write GetUrlBody("http://www.codeproject.com/")
...

Installation

Besides the latest version of ActiveState's ActivePerl, you need to download and install the libwww-perl from cpan.org.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Uwe Keim
Chief Technology Officer Zeta Producer Desktop CMS
Germany Germany
Uwe does programming since 1989 with experiences in Assembler, C++, MFC and lots of web- and database stuff and now uses ASP.NET and C# extensively, too. He has also teached programming to students at the local university.

In his free time, he does climbing, running and mountain biking. Recently he became a father of a cute boy.

Some cool, free software from us:

Deutschsprachiges Forum zu Elektromobilität und Tesla  
Windows 10 Ereignisanzeige  
German Developer Community  
Free Test Management Software - Intuitive, competitive, Test Plans. Download now!  
Homepage erstellen - Intuitive, very easy to use. Download now!  
Send large Files online for free by Email
Offline-Homepage-Baukasten

Comments and Discussions

 
QuestionLWP? Pin
Anonymous28-Apr-04 17:15
MemberAnonymous28-Apr-04 17:15 
QuestionEasier way? Pin
30-Jul-01 4:42
suss30-Jul-01 4:42 
AnswerRe: Easier way? Pin
6-Mar-02 19:35
suss6-Mar-02 19:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.