LWP::UserAgent - read timeout
Denis Kotseba (kdl@softhome.net)
Tue, 11 May 1999 18:40:59 +0900
Hi,
I am trying to write a script retrieving the output of the CGI-script on a
remote server.
It's the first experience with LWP, so I just took the code from the manual
and substituted values. Whenever I run my script, I get the '500 : read
timeout' message. If I try to retrieve a plain HTML file from the same
server, everything works fine. I tried many servers with the same result.
Changing $ua->timeout value produces no difference.
What is my mistake? Please help.
Thanks!
--------
Following is the source code of the script and a the HTML code for the form:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
# Create a user agent object
my $ua = new LWP::UserAgent;
$ua->agent('SearchAgent/1.0');
$ua->timeout('10'); # changing value or even commenting out the entire
line makes no difference
# Create a request
my $req = new HTTP::Request GET =>
'http://www.cogsci.princeton.edu/cgi-bin/webwn/';
$req->content_type('application/x-www-form-urlencoded');
$req->content('stage=1&word=search');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
print $res->code, " : ", $res->message, "\n", $res->content, "\n";
FORM ACTION=http://www.cogsci.princeton.edu/cgi-bin/webwn/ METHOD=GET>
<INPUT TYPE=HIDDEN NAME=stage VALUE=1>
Search word: <INPUT TYPE=TEXT NAME=word>
<INPUT TYPE=SUBMIT VALUE="Find valid searches">
</FORM>