Hi Todd

Thanks a lot for the pointer.

WWW::Mechanize was exactly what I needed.

Using it's field replacement, I could log in to the site without any problem
with the cookies.

However, the next web page from where I actually want to send the message
contains a text box for the mobilenumber and textarea for the message.

The textbox was filled with the mobile number easily using
$agent->field("mobilenumber","+9198155...");

Result :

<input TABINDEX="1" TYPE="text" NAME="mobilenumber" MAXLENGTH="200"
SIZE="55"  VALUE="+9198155...">

All is great till this point.

The hurdle now is that I could not find any method to populate the textarea
:(

Here is the html line from page where I'm supposed to put the message :
----------------------------------------------------------------------------
<textarea TABINDEX="2" ID="message" NAME="message" COLS="45" ROWS="4"
WRAP="PHYSICAL" onBlur="textRemaining();" onfocus="textRemaining();"
onkeydown="textRemaining();" onkeypress="textRemaining();"
onkeyup="textRemaining();"></textarea>
----------------------------------------------------------------------------

Could anyone please tell me how I could populate the textarea using
Mechanize so that a submit() would send the msg on it's way...

Thanks you so much
aman



-----Original Message-----
From: Todd Wade [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 11:02 PM
To: [EMAIL PROTECTED]
Subject: Re: Cookies rejected



"Aman Thind" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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.
>

You are running in to some very usual issues with http clients. Really the
best we ( or at least myself ) can say is that you are not sending a
properly formatted cookie.

There is a module called WWW::Mechanize that helps facilitate what you are
trying to do. You might want to give it a look.

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to