sheltem has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I want to write some Perl-progams to make analyses. My problem: lynx -accept_all_cookies -base -source http://www.mypage.html | myscript.pl > results.txt does not work, because lynx is not installable on the server. Is there a way to get the content from an URL into Perl, maybe in an variable? The best way would be, I give the URL as a parameter to my perl-skipt like: myscript.pl http://www.mypage.html > results.txt Greetings from Frankfurt Roman
  • Comment on Need help getting the content from a link

Replies are listed 'Best First'.
Re: Need help getting the content from a link
by rob_au (Abbot) on Jan 16, 2003 at 08:33 UTC
    How about this ...

    #!/usr/bin/perl use LWP::Simple; my $content = get 'http://www/mypage.html';

    ... or passing the URL to the script from the command line ...

    #!/usr/bin/perl use LWP::Simple; my $url = shift @ARGV; my $content = get $url;

    ... or from the command line ...

    perl -MLWP::Simple -e 'print get "http://www/mypage.html"'

     

    perl -le 'print+unpack("N",pack("B32","00000000000000000000001000010111"))'

      Thank You! With getprint.. it works!!!
Re: Need help getting the content from a link
by Callum (Chaplain) on Jan 16, 2003 at 08:32 UTC