Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: Passing value for a GET Method

Posted on 2008-04-08 14:43:47 by Prabu Ayyappan

Hi,

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/

Report this message

#2: Re: Passing value for a GET Method

Posted on 2008-04-08 23:35:49 by Gunnar Hjalmarsson

Prabu Ayyappan wrote:
> I want to Pass values for GET method. As like we pass value for POST method

<snip>

> 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);

So why don't you stick with that?

I don't think that GET requests are supposed to have contents.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Report this message