Click here to Skip to main content
Click here to Skip to main content
Go to top

Retrieve a HTML page from within your (ASP-)Scripts without any components

, 28 Aug 2001
Rate this:
Please Sign up or sign in to vote.
Tiny little Perl library to retrieve an arbitrary URL as a string.
<!-- Download Links --> <!-- Add the rest of your HTML here -->

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.

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:
 
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? PinsussAnonymous28-Apr-04 17:15 
QuestionEasier way? PinmemberAnonymous30-Jul-01 4:42 
AnswerRe: Easier way? PinmemberAnonymous6-Mar-02 19:35 

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

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 29 Aug 2001
Article Copyright 2001 by Uwe Keim
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid