Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things


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 => ' +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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2023-12-07 13:44 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (32 votes). Check out past polls.