Click to See Complete Forum and Search --> : Finding links on a specified page
druss
12-03-2003, 12:37 AM
i want a script to automatically search for links in a page and prints it all out. however i thought it is clumsly just searching for <a href> tags so i was wondering is there an easier way like using a perl module or anything else.
Thanks
Goran
...have a look here...
http://www.perldoc.com/perl5.6/lib/HTML/LinkExtor.html
druss
12-09-2003, 05:07 AM
It doesnt seem to be working in the way i want it.
can you please tell me how to retrieve links from a page where the source code is already recieved in a @ array by using the use LWP method.
For example i get the source code with the following code:
use LWP::Simple;
@source = get($link);
is there a way by using the method supplied in the link in the post before and if so could you please give me an example of how to implement it....
Thanks
Goran
Jeff Mott
12-09-2003, 01:51 PM
use LWP::Simple qw[get];
use HTML::LinkExtor;
my $p = HTML::LinkExtor->new(sub
{
my($tag, %links) = splice @_;
print "$_\n" for values %links;
});
$p->parse(get('http://www.perl.com'));