Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

WebMail login popup

by moked (Beadle)
on Jun 01, 2009 at 14:17 UTC ( [id://767263]=perlquestion: print w/replies, xml ) Need Help??

moked has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm trying to use the next code in order to check my webmail server:
use WWW::Mechanize; use HTTP::Cookies; use Stream::Reader; $url="https://webmail.com/exchange"; my $username = "UserName"; my $password = "Password123"; my $mechanize = WWW::Mechanize->new(autocheck => 1); $mechanize->cookie_jar(HTTP::Cookies->new()); $mechanize->get($url); $mechanize->form_name('logonForm'); $mechanize->field(username => $username); $mechanize->field(password => $password); $mechanize->click(); $mechanize->get("https://webmail.com/exchange/username/Inbox/?Cmd=cont +ents&Page=1"); my $page = $mechanize->content();
However, I get en error while running it:
Error GETing https://webmail.com/exchange/: Unauthorized
I entered the site manually,
and found out that the username and password,
are not being captured by a form in the page,
but by a pop up window.

I seeking help trying to handle this window.
will the mechanize work on this window?

Thanks in advance,
Moked

Replies are listed 'Best First'.
Re: WebMail login popup
by Corion (Patriarch) on Jun 01, 2009 at 14:49 UTC

    Alternatively, you might mean by "pop up window" that your browser is asking for Basic Authentication. See WWW::Mechanize on how to supply credentials or encode them directly in the starting UR as https://$username:$password\@....

Re: WebMail login popup
by dorward (Curate) on Jun 01, 2009 at 14:43 UTC

    If it is using a popup window then it must be using JavaScript, in which case there are plenty of solutions on this site already.

    Incidently, http://webmail.com/exchange is timing out for me. You might want to check that isn't the cause of your issues. (Assuming webmail.com is real and you didn't mean example.com)

Re: WebMail login popup
by Errto (Vicar) on Jun 02, 2009 at 14:52 UTC
    Exchange Web Access (at least the versions I've used) uses HTTP authentication. So I'd strongly recommend following Corion's advice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://767263]
Approved by Perlbotics
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-25 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found