Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: how to import hotmail addressbook by WWW::Mechanize or something else

by inman (Curate)
on Nov 21, 2006 at 13:48 UTC ( [id://585259]=note: print w/replies, xml ) Need Help??


in reply to how to import hotmail addressbook by WWW::Mechanize or something else

The login process looks complicated but it is ultimately cookie based and will just take some working out. You can avoid getting the script to log in by preparing the cookies beforehand.

Try logging into hotmail using Mozilla or Firefox as your browser (I prefer Mozilla for this). Clear the cookies using the cookie manager. Choose the "save my credentials" option when you log in. This saves a number of cookies into the cookies.txt file. (location varies depending on OS but try under C:\Documents and Settings\<MyAccount>\Application Data\Mozilla\Profiles on Windows).

The cookies.txt file is in Netscape Format so you will need to load it up using HTTP::Cookies::Netscape. All your code needs to do now is to handle the redirection (which WWW::Mechanize should do OK).

This is all untested but I have used a similar script elsewhere. In general, Mozilla and LiveHTTPHeaders is a good debug combination.

  • Comment on Re: how to import hotmail addressbook by WWW::Mechanize or something else

Replies are listed 'Best First'.
Re^2: how to import hotmail addressbook by WWW::Mechanize or something else
by fayland (Acolyte) on Nov 22, 2006 at 01:49 UTC
    yup, I tried as what you said. no luck indeed.
    use HTTP::Cookies::Netscape; my $cookie_jar = HTTP::Cookies::Netscape->new( file => 'E:/lwp_cookies.dat', autosave => 1, ); my $mech = WWW::Mechanize->new( agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', cookie_jar => $cookie_jar, stack_depth => 1, autocheck => 1, );
    mm, we brought a script written by php. it uses 'curl_exec' and works fine. I tried to search in CPAN. and find WWW::Curl, but failed to install this module. (install progress stoped at test).
    I just wonder whether anyone has written a similar script and give me a hint.
    Thanks for your tip any way, inman.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-16 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found