in reply to Browser Emulation
This is a pretty simple-minded example how you might do this using LWP::UserAgent and HTML::Parser:
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTML::Parser; use URI; my $starturl = shift || die "No url supplied\n"; my $baseuri = URI->new($starturl); my @urls ; push @urls,$starturl; my $agent = new LWP::UserAgent; my $parser = HTML::Parser->new(api_version => 3, start_h => [\&start ,"tagname, attr"]); $agent->agent("Gelzilla/666"); while( my $url = shift @urls) { my $request = new HTTP::Request 'GET' => $url; my $result = $agent->request($request); if ($result->is_success) { print $result->as_string; $parser->parse($result->content); } else { print "Error: " . $result->status_line . "\n"; } } sub start { my($tag,$attr) = @_; if ($tag eq 'frame' ) { my $thisuri = URI->new($attr->{src}); push @urls, $thisuri->abs($baseuri); } }
Of course you are going to have to make your own arrangements for displaying things properly :)
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Browser Emulation
by jonjacobmoon (Pilgrim) on Feb 03, 2002 at 17:34 UTC |