in reply to Re: replace relative links with absolute links
in thread replace relative links with absolute links
#!/usr/bin/perl -w use strict; my @imgs; my $lx = HTML::LinkExtor->new(\&img); my $respond = LWP::UserAgent->new->request(HTTP::Request->new(GET => ' +http://www.ibm.com')); my $base = $respond->base; $lx->parse($respond->content); for(@imgs){ print "Relative: $_\n"; print "Full: ",url($_,$base)->abs,"\n\n"; } sub img{ my($tag,%links) = @_; push(@imgs,values %links) if($tag eq 'img'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: replace relative links with absolute links
by PodMaster (Abbot) on Jan 06, 2003 at 22:59 UTC |