in reply to replacement for LWP::Simple ?

I tried:
#!/usr/local/bin/perl -w my $myDocument; my $result; use lib '.'; use LWP::Simple; $myDocument = get "http://www.ecst.csuchico.edu/"; if ($myDocument) { # we got a response $result = $myDocument; } else { # Something went wrong $result = "<tt>There was a problem somewhere and I didn't get an ans +wer.</tt>"; }; print "Content-type: text/html\n\n"; print $result;
And I got a message:
There was a problem somewhere and I didn't get an answer.
Jacek

Replies are listed 'Best First'.
Re: Re: replacement for LWP::Simple ?
by Util (Priest) on May 15, 2002 at 02:04 UTC

    Since your code works correctly for us, but not for you, you will have to do the debugging. You may need to tell LWP to use a proxy; check your web-browser to see whether it has a proxy configured. Here are some documents on LWP proxy use and debugging:

    Also, from your "Content-type: text/html\n\n" statement, I take it that you are testing this program as a CGI script on a web server. Can you test it from the command line instead? If so, you will be able to see error output that would have been hidden by the web server. Get as much working from the command line as you can, and only then turn it into a CGI; much aching of the head will be avoided.