On Fri, January 5, 2007 10:31 pm, Iqbal Naved wrote:
> I am desparately looking for a solution for importing address book
> from aol
> webmail to my browser. I found some commercial solution (such as,
> http://svetlozar.net) which was done using cURL. But couldnt find any
> php
> classes to implement it. Anyone can help me how to implement this ? As
> far
> as i could go is this code which can successfully log in to aol :
>
> <?php
> $login = 'abcd';
> $pass = '1234';
>
> $url = "https://my.screenname.aol.com/_cqr/login/login.psp";;
> $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
> $postvars =
> "screenname=".$login."&password=".$pass."&submitSwitch=1&siteId=aolcomprod&mcState=initialized&authLev=1";
> $cookie = "cookies/test";
> @unlink($cookie);
>
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
> curl_setopt($ch, CURLOPT_CAINFO, "E:/aol_grab/curl-ca-bundle.crt");
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
> curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> $content = curl_exec ($ch);
> file_get_contents("http://d02.webmail.aol.com/22250/aol/en-us/Suite.aspx";);
> //print_r(curl_getinfo($ch));
> //echo "\n\ncURL error number:" .curl_errno($ch);
> //echo "\n\ncURL error:" . curl_error($ch);
> curl_close ($ch);
> unset($ch);
> echo "<PRE>".htmlentities($content);
> ?>
>
> and I was able to log in to it successfully..the output is as below
> HTML Code:
>
> <pre>HTTP/1.0 200 OK Date: Wed, 20 Dec 2006 09:31:47 GMT Server:
> Apache
> Pragma: No-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie:
> RSP_COOKIE=type=23&amp;name=SXFiYWxuYXZlZA%3D%3D&amp;stype =100;
> Domain=.aol.com; Expires=Sat, 15-Dec-2007 09:31:47 GMT; Path=/
> Set-Cookie:
> SNS_TT=AAppcWJhbG5hdmVkRYkDAwAAEAABADzZgUOA2md9Z10
> eZXKIoglrjoCeCrbwVT0pwLi4eVd8mDKn%2BVKco%2FRRi%2F5
> rNTsm5vMgc1UlyzEDQ%2BXxYeQ%3D; Domain=my.screenname.aol.com;
> Expires=Fri,
> 19-Jan-2007 09:31:47 GMT; Path=/ Set-Cookie: MC_CMP_ESK=NonSense;
> Domain=.aol.com; Path=/ Set-Cookie:
> SNS_SKWAT=diAyLjAga2lkIDEgdDF5SDJxYmROcHhxN0FHbEh6
> V1hDMmJLc0djPQ%3D%3D-b0o7Q4xCU%2F39IESbtoTm9mBdSL47fxxUnmD4X1Pn82%2Fol%
> 2B03%2BtxOLynThOHeQsaL5xdmerZnzZT34sulbmtlrezipaPL
> kGMHiXQBbDQpCZb53AT7EPRZ2sWEvYfeP0a9rf%2FDn%2F2ER3
> 2h0rLA5%2B7UMs6NmHharvEJQCFkTVYUHyjUa6btTL8twXF4Jm
> siXUX0uXBuOHibk6Pl9lKtKJj779U%2BiXUU4oBiSpcg6Q%2FY
> KJUvGNsk4cjDURDglR9SsQL0iCJ2S1w4YGA%3D; Domain=screenname.aol.com ;
> Path=/
> Set-Cookie: SNS_SC=diAxLjAga2lkIDEgQ2R1RXNSeDJGTDZ3SmNNMXRkMUt
> hQ25kdEhZPQ%3D%3D-dwYGM2lmn8IsM5qbIMCD4cF876hxn28LVqa2CrLuSNY%2FClN5
> 8OIf%2Bg1GbhwkQ8c4%2BoZTQgtZjkKb0gS4x9xI2v1HzzyBQU
> 7%2FUGAuyvgR9SWpqJmjzOpUJldJIJHA43WwgahRfwXBKCp8Ci
> B%2FPMLCa4bSsNdpgaEVUgc%2FrdXCOOU%3D; Domain=my.screenname.aol.com;
> Path=/
> Set-Cookie: SNS_L0=diAxLjAga2lkIDEgUUpsdVVrUWtzb21SOFhPdGo1SFo
> 2R2swQzJzPQ%3D%3D-RgHJcTIzyWP%2BQIb7S6lE%2BpdmQv1XVmfP; Domain=
> screenname.aol.com ; Expires=Tue, 15-Jul-2036 09:31:47 GMT; Path=/
> Set-Cookie: SNS_LDC=1 aolcomprod 1 1166607107 0 1166607107 0; Domain=
> my.screenname.aol.com; Expires=Fri, 19-Jan-2007 09:31:47 GMT; Path=/
> Set-Cookie: SNS_AA=asrc=2&amp;sst=1166607107; Domain=.aol.com; Path=/
> P3P:
> CP="PHY ONL PRE STA CURi OUR IND" Content-length: 1505 Cache-control:
> no-cache Content-language: en-US Content-type: text/html;charset=utf-8
> Connection: close &lt;html&gt;&lt;head&gt;&lt;title&gt;Scr
>
>
>
> But i dont know how to fetch the email addresses from the contact
> list. Any
> one can help me on this ?

Login to AOL "by hand" and compare the two outputs.

Then look for the link or button that accesses your address book.

Then have your curl script do that, just like it logged in.

You will want your COOKIEJAR to be your COOKIEFILE as well for all
subsequent curl operations.

COOKIEJAR is for the cookies coming "in" and then COOKIEFILE sends
them out again -- Make them the same to maintain state.  (The Usual)

They are different just in case you need to do that, but it's kinda
rare, I think.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to