You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Yann Ramin <at...@atrustrivalie.eu.org> on 2000/08/26 06:33:14 UTC

Re: Getting data from external URL

If you're in a modperl enviroment, and don't use CGI.pm, try using
Apache::Request (I'm not a fan of using Apache.pm for too much).  Has
anyone ever considered making a wrapper for all the modules which get
back data from the request (roll Apache::Request, Apache::Cookie, etc,
into one)?  Seems trivial.

Yann


Vijay wrote:
> 
> Hello,
> 
> I want to get data from an external url in my perl program (either thru
> Embperl Execute or directly from perl). What I need is like this.
> 
> There is a URL which gives some information in text format. I want to get
> that into a variable or file using perl and using my own html templates, I
> want to show that data.
> 
> If anyone has done something like this, please let me know.
> 
> Thanks
> 
> Vijay

-- 

--------------------------------------------------------------------
Yann Ramin			atrus@atrustrivalie.eu.org
Atrus Trivalie Productions	www.redshift.com/~yramin
Monterey High IT		www.montereyhigh.com
ICQ 				46805627
AIM				oddatrus
Marina, CA

IRM Developer                   Network Toaster Developer
SNTS Developer                  KLevel Developer

(yes, this .signature is way too big)

"All cats die.  Socrates is dead.  Therefore Socrates is a cat."
	- The Logician

		THE STORY OF CREATION

In the beginning there was data.  The data was without form and null,
and darkness was upon the face of the console; and the Spirit of IBM
was moving over the face of the market.  And DEC said, "Let there be
registers"; and there were registers.  And DEC saw that they carried;
and DEC seperated the data from the instructions.  DEC called the data
Stack, and the instructions they called Code.  And there was evening
and there was a maorning, one interrupt...
		-- Rico Tudor

William Safire's Rules for Writers:

Remembe

Re: Getting data from external URL

Posted by Rob Tanner <rt...@onlinemac.com>.
Apache::Request simply maps the Apache object into an Apache::Request 
object (I know that sounds like double-speak, but it's late), and adds 
some extra methods.  I don't think that's what Vijay's original 
question is all about.

What's needed is an HTTP::Request object.  Look at LWP::UserAgent 
which brings together HTTP::Request and HTTP::Response objects and you 
also should grab HTTP::Headers.  Like I said, it's late.  I think that 
whole collection ball of wax is in libwww-perl available on CPAN. 
Other than the parsing and redisplaying that Vijay asked about, that's 
pretty much what a proxy server does, and there's a pretty detailed 
example or two in the Eagle book.  As far as the parsing that response 
data, a mixture of good ole perl technique and HTML::Parser should be 
sufficient.

-- Rob

--On 08/25/00 21:33:14 -0700 Yann Ramin <at...@atrustrivalie.eu.org> 
wrote:

> If you're in a modperl enviroment, and don't use CGI.pm, try using
> Apache::Request (I'm not a fan of using Apache.pm for too much).  Has
> anyone ever considered making a wrapper for all the modules which get
> back data from the request (roll Apache::Request, Apache::Cookie, etc,
> into one)?  Seems trivial.
>
> Yann
>
>
> Vijay wrote:
>>
>> Hello,
>>
>> I want to get data from an external url in my perl program (either
>> thru Embperl Execute or directly from perl). What I need is like
>> this.
>>
>> There is a URL which gives some information in text format. I want
>> to get that into a variable or file using perl and using my own html
>> templates, I want to show that data.
>>
>> If anyone has done something like this, please let me know.
>>
>> Thanks
>>
>> Vijay
>
> --
>
> --------------------------------------------------------------------
> Yann Ramin			atrus@atrustrivalie.eu.org
> Atrus Trivalie Productions	www.redshift.com/~yramin
> Monterey High IT		www.montereyhigh.com
> ICQ 				46805627
> AIM				oddatrus
> Marina, CA
>
> IRM Developer                   Network Toaster Developer
> SNTS Developer                  KLevel Developer
>
> (yes, this .signature is way too big)
>
> "All cats die.  Socrates is dead.  Therefore Socrates is a cat."
>	 - The Logician
>
>		 THE STORY OF CREATION
>
> In the beginning there was data.  The data was without form and null,
> and darkness was upon the face of the console; and the Spirit of IBM
> was moving over the face of the market.  And DEC said, "Let there be
> registers"; and there were registers.  And DEC saw that they carried;
> and DEC seperated the data from the instructions.  DEC called the data
> Stack, and the instructions they called Code.  And there was evening
> and there was a maorning, one interrupt...
>		 -- Rico Tudor
>
> William Safire's Rules for Writers:
>
> Remembe




       _ _ _ _           _    _ _ _ _ _
      /\_\_\_\_\        /\_\ /\_\_\_\_\_\
     /\/_/_/_/_/       /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
    /\/_/__\/_/ __    /\/_/    /\/_/          PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_/    /\/_/
  /\/_/ \/_/  /\/_/_/\/_/    /\/_/         (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/     \/_/              appears profound)

  Rob Tanner
  McMinnville, Oregon
  rtanner@onlinemac.com