Reputation: 1209
I'm having an error with HTTP::Request in perl, where it wont post with the quesry string as shown bellow:
$request = HTTP::Request->new(POST => "http://example.com/file.pl?query=blablabla");
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
It's not sending the post with "?query=blablabla" rather only sending the post to "http://example.com/file.pl" instead of http://example.com/file.pl?query=blablabla
Upvotes: 0
Views: 225
Reputation: 39365
This should work.
$param = "query=blablabla";
$req = HTTP::Request->new(POST => $url);
$req->content($param);
$ua = LWP::UserAgent->new;
$res = $ua->request($req);
Also you can add headers to your request like this:
$req->header('Accept-Encoding' => "gzip,deflate");
$req->header('Accept-Charset' => "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
Upvotes: 1