develooper Front page | perl.beginners | Postings from June 2003

Cookies rejected

Thread Next
From:
Aman Thind
Date:
June 24, 2003 05:54
Subject:
Cookies rejected
Message ID:
7D5800A5B6E26644B2EB7A862856B0D408966C21@SARASWATI
Hi All

On receiving no reply to my previous post, I myself struggled a bit and came
up with the following code to login to the site :

--------------------------------------------------------------
use LWP::UserAgent;
use HTTP::Cookies;
  
$ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt",autosave => 1));

my $req = HTTP::Request->new(POST => 'http://www.sms.ac/login.asp');
$req->content_type('application/x-www-form-urlencoded');
$req->content('loginuserid=myuserid&loginpassword=mypassword');
my $res = $ua->request($req);
print $res->as_string; 
--------------------------------------------------------------

However, on running this script, a web page with the following message is
returned :

Unable to establish login (cookies rejected).

Could someone please guide me how to overcome this.

Thanks in anticipation,
aman


-----Original Message-----
From: Aman Thind [mailto:AThind@quark.co.in]
Sent: Monday, June 23, 2003 2:05 PM
To: beginners@perl.org
Subject: Log into a site and do stuff


Hi

I am working on a module that occasionally needs to raise alarms by sending
sms to concerned ppl.

For this, I would like to login to the site : www.sms.ac

The login page is http://www.sms.ac/login.asp

Then I have to go to the main page , fill the To: and Message: textboxes and
send sms.

I have no prior experience with LWP and couldn't make much use of "perldoc
lwpcook"

Could someone please tell me how I can accomplish this feat.

A pointer towards a newbie resource on this perl feature or some sample code
will surely help.

Thanks
aman

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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About