[thelist] CGI::get?

Dwayne Holmberg dholmberg at medialogic.ca
Wed Aug 23 23:15:42 CDT 2000


Jeremy Ashcraft writes:
 > I remember vaguely a reference to a perl function in the CGI.pm module
 > that you can pass it a url and it will return the contents of that page
 > in a string.  Something like
 > 
 > $text = CGI::get("http://www.evolt.org");

i don't recall this in CGI.pm offhand, but you might be thinking of LWP::UserAgent

#!/usr/bin/perl
use LWP::UserAgent;

my $ua = new LWP::UserAgent('bob/0.02', 'wowbobwow at blacklodge.com');
my $request = new HTTP::Request('GET', $url);  # inheritted by LWP::UserAgent

my $response = $ua->request($request);
my $content = $response->content();

__END__

on vacation and mixing fine martinis, so please check this against the docs.

- dwayne





More information about the thelist mailing list