in reply to Webpage Contents
From there you can do whatever you want with it as far as parsing goes. I even added some interaction from the user functionality in the above code which is not needed. At the very least you can use this code to see if the site has an issue or your code has an issue. I ran this against my own site and perlmonks site and had no issues.#!perl -w use strict; use LWP::Simple; my $site = $ARGV[0] || "http://www.perlskripts.com"; my $command = get($site); die "An error has occured!" unless defined $command; print $command;
You also seem to have a minor code error that keeps the script from running. Change the following:
to this:my $ua = LWP::UserAgent->new( keep_alive => 1 ); timeout => 30 );
Also change the following:my $ua = LWP::UserAgent->new( keep_alive => 1, timeout => 30 );
to:unless ($response->is_success) { print "Response status is: ", $response->status_line(); return undef; }
The return is not needed nor is it allowed.print "Response status is: ", $response->status_line() unless ($respo +nse->is_success);
Now with both those minor changes in place I run the script and get an error code 500 which I am assuming is because you have changed the IP addresses in your code to protect the innocent. :-)
If you plug in all your correct data back into this script you might have better results.
|
|---|