in reply to Re: how to read data from a URL
in thread how to read data from a URL
# An example using WWW::Mechanize and URI::Escape
use strict;
use WWW::Mechanize;
# Create a new mechanize object
my $mech = WWW::Mechanize->new();
my $url = 'http://www.exampleurl.com/';
# Associate the mechanize object with a URL
$mech->get($url);
# Print the content of the URL
print $mech->content;
# Load URL::Escape to escape URI's with uri_escape method.
use URI::Escape;
my @links = $mech->links;
foreach my $link (@links) {
print uri_escape($link->url), "\n";
}
|
|---|