http://qs321.pair.com?node_id=615485


in reply to how to read data from a URL

Something like the following should get you going:

use strict; use warnings; use LWP::Simple; my $url = "http://whatev.er"; my $content = get($url); $content =~ s/ /%20/g;

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus

Replies are listed 'Best First'.
Re^2: how to read data from a URL
by xhunter (Sexton) on May 15, 2007 at 23:29 UTC
    # 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";   
    }