Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Passing Creaden...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 11036 of 11065
Post > Topic >>

Passing Creadentials and parameters through http headers

by prabu.ayyappan@[EMAIL PROTECTED] (Prabu Ayyappan) May 7, 2008 at 02:42 AM

Hi all,=0A=0AI want to Pass the credentials and the Post parameters in a
re=
quest and need to get the response content.=0A=0AI tried with the
following=
 approach. =0A=0A1) Credentials are getting passed correctly however am
not=
 getting the parameter passed. =0A=0A2) If am passing the credentials in
th=
e url it is working fine. I want to pass the credential in header=0A=0A3)
G=
etting 401 - AUTH_REQUIRED Message=0A=0AMethod I:=0A=0Ause
LWP::UserAgent;=
=0Ause HTTP::Request;=0Ause HTTP::Request::Common;=0Ause
Data::Dumper;=0Amy=
 $ua =3D new LWP::UserAgent;=0A$username =3D 'username';=0A$password =3D
'p=
assword';=0A$uri =3D 'https://url/goeshere';=0A$in
=3D {'test1' =3D>
'test'=
};=0Amy $ua =3D LWP::UserAgent->new;=0Amy $req =3D HTTP::Request->new(POST
=
=3D> $uri,Content =3D> $in);=0A$req->authorization_basic($username,
$passwo=
rd);=0A$req->header("Content-Type" =3D>
"application/x-www-form-urlencoded"=
);=0Amy $output=3D$ua->request($req)->content;=0Aprint Dumper $output;=0A=
=0AMethod II:=0A=0Ause LWP::UserAgent;=0Ause HTTP::Request;=0Ause
HTTP::Req=
uest::Common;=0Ause Data::Dumper;=0Amy $ua =3D new LWP::UserAgent;=0A$in =
=3D {'test1' =3D> 'test'};=0Amy $res =3D
$ua->post('https://username:passwo=
rd@[EMAIL PROTECTED]
', $in);=0Aprint Dumper $res->content;=0A=0AMethod III:=0A=
=0Ause LWP::UserAgent;=0Ause HTTP::Request;=0Ause
HTTP::Request::Common;=0A=
use Data::Dumper;=0Amy $ua =3D new LWP::UserAgent;=0A$url =3D
"https://url/=
goeshere";=0A$in =3D {'test1' =3D> 'test'};=0A$ua->credentials($url,
'TESTR=
EALM', 'username' =3D> 'password');=0Amy $res =3D $ua->post($url,
$in);=0Ap=
rint Dumper $res->content;=0A=0A=0APlease guide me, =0A=0AI want to Pass
bo=
th credentials and parameters through headers.=0A=0AThanks,=0APrabu=0A=0A=
=0A=0A      Unlimited freedom, unlimited storage. Get it now, on
http://hel=
p.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/




 2 Posts in Topic:
Passing Creadentials and parameters through http headers
prabu.ayyappan@[EMAIL PRO  2008-05-07 02:42:32 
Re: Passing Creadentials and parameters through http headers
yitzle@[EMAIL PROTECTED]   2008-05-07 09:30:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 15:01:27 CDT 2008.