[Israel.pm] web-based script
Mikhael Goikhman
migo at homemail.com
Tue Aug 31 08:32:26 PDT 2004
On 31 Aug 2004 17:30:04 +0300, Uri Bruck wrote:
>
> Shlomo Yona wrote:
> >
> > On Tue, 31 Aug 2004, Yuval Yaari wrote:
> > >
> > > This can be done with wget and/or lwp-request and/or curl.
> >
> > I was hoping for a snippet... I guess I'll RTFM...
>
> my $url = 'http://the.url?param1=val1';
> require HTTP::Request;
> require LWP::UserAgent;
> my $ua = LWP::UserAgent->new;
> my $request = HTTP::Request->new(GET => $url);
> my $response = $ua->request($request);
> my $content = $response->content();
>
> $content should contain the web page you downloaded.
Or, if you are really lazy, use LWP::Simple.
use LWP::Simple;
my $content = get("http://www.sn.no/")
Of course, like others said, wget may be even more appropriate. man wget.
Regards,
Mikhael.
--
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'
More information about the Perl
mailing list