Passing value for a GET Method
am 08.04.2008 14:43:47 von Prabu AyyappanHi,
I want to Pass values for GET method. As like we pass value for POST method
use strict;
use warnings;
my $browser = LWP::UserAgent->new;
my $word = $ARGV[0];
my $url = 'http://mylink';
my $response = $browser->post( $url,['q' => $word]);
die "$url error: ", $response->status_line unless $response->is_success;
die "Weird content type at $url -- ", $response->content_type unless $response->content_type eq 'text/html';
print $response->content;
I tried with the following methods for a GET Method.
Method I:
my $response = $browser->get($url,['user' => 'json:['testuser']']);
Method II:
$req = HTTP::Request->new(GET => $url);
$req->content("user=json:['testuser']");
Method III:
after encoding the query string
$req = HTTP::Request->new(GET => $url);
$req->content("user=json%3A%5B%27testuser%27%5D");
When am passing the value through the Query String it is working
http://mylink?user=json%3A%5B%27testuser%27%5D
$req = HTTP::Request->new(GET => $url);
Please help me, How to pass value through the request headers.
Thanks,
Prabu
____________________________________________________________ ________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/