Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

HTTP::Request

by Anonymous Monk
on May 14, 2005 at 20:53 UTC ( #457125=perlquestion: print w/replies, xml ) Need Help??

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

Hi, I want to set the $content values in a request but I am not successfull.
$r = HTTP::Request->new( $method, $uri, $header, $content )> Method and uri are alright. Header optional. But I have to set the content to other values than the standard ones.
my $userAgent = LWP::UserAgent->new(); my $request = HTTP::Request->new(POST => 'http://genome.ucsc.edu/cgi-b +in/hgBlat?command=start', [ org => "D. majovensis", userSeq => "$alignmentQuery", submit => "submit", ] ); my $response = $userAgent->request($request); if($response->is_success) { open(FILE, "> $_.html") or die $!; print FILE $response->content; close FILE; }
This is the code ... but I never get anything else than the standard page. Where is my fault. I know that maybe my §content values are incorect and so not taken by the javascript... Or is it anything else? That underlined thing should be in rectangular brackets. (Dont blame on me.. just help a poor man :) Thank you.

Replies are listed 'Best First'.
Re: HTTP::Request
by ikegami (Patriarch) on May 14, 2005 at 22:28 UTC

    The header argument is only optional when the content is omitted. Fortunately, you can use undef for the header argument:

    my $request = HTTP::Request->new(POST => 'http://...', undef, [ ... ])

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://457125]
Approved by chromatic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-08-18 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?