Get MSN (HOTMAIL) Mailbox Friends Sync Update 2011-8
Last year's MSN (HOTMAIL), Gmail, Yahoo three analog login, now MSN has expired
In the CSDN forum to pay more attention to friends, work also need this, so once again picked up the HTTP analysis tools to get a glimpse
This analysis found that MSN makes people laugh and cry, they are logged in the last step, the cookie detection, detection of cookies is normal but
It's just that he detects extra cookies this time, and if there are extra cookies, please just ask me out, but only in the final step to filter the cookies they need.
Okay, on the code (basically the same as last time, just a few more in the middle of a cookie filter)
My blog: www.onlypo.com
PHP Code
/I ', $str, $matches); $PPFT = $matches [2]; $type = 11; $LoginOptions = 3; $Newuser = 1; $idsbho = 1; $i 2 = 1; $i 12 = 1; $i 3 = ' 562390 '; $i 14 = ' 868 '; $i 15 = ' 1338 '; $PPSX = ' Pa '; Merge parameter $postfiles = "login=". $username. " &passwd= ". $password." &type= ". $type." &loginoptions= ". $LoginOptions." &newuser= ". $Newuser." &idsbho= ". $idsbho." &i2= ". $i 2." &i3= ". $i 3." &ppft= ". $PPFT." &ppsx= ". $PPSX." &i12=1&i14= $i 14&i15= $i 15 "; Step two: Start logging in $ch = Curl_init (); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_cookiefile, Cookiejar); curl_setopt ($ch, Curlopt_url, ' https://login.live.cOm/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct= '. (Time () +5). ' &rver=6.1.6206.0&wp=mbi&wreply=http:%2f%2fmail.live.com%2fdefault.aspx&lc=2052&id=64855 &mkt=zh-cn&cbcxt=mail&snsc=1&bk= '. (Time () +715)); The two time (s) here are to simulate random times curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields, $postfiles); curl_setopt ($ch, Curlopt_cookiejar, Cookiejar); curl_setopt ($ch, Curlopt_header, 1); curl_setopt ($ch, Curlopt_timeout, TIMEOUT); curl_setopt ($ch, Curlopt_returntransfer, true); $content = curl_exec ($ch); Curl_close ($ch); if (Stripos ($content, ' Wlworkflow ')!== false) {//wlworkflow login page js return false; Login failed}//Get location link $matches = Array (); Preg_match ('/window.location.replace\ (\"(.*?) \ "\)/I ', $content, $matches); $url _contiune_1 = $matches [1]; The next link if (! $url _contiune_1) {return false; }//Remove redundant cookies $arr _new = file (Cookiejar); $str _new = "; $need _arr = Array (0,1,2,3,7,9,13,15,16,17,18,21,22); foreach ($arr _new as $k = + $v) {if (In_array ($k, $need _arr)) $str _new. = "$v"; } $fp = fopen (Cookiejar, "w+"); Fwrite ($fp, $str _new); Fclose ($FP); Step three: Enter the boot page $ch = Curl_init (); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_cookiefile, Cookiejar); curl_setopt ($ch, Curlopt_url, $url _contiune_1); curl_setopt ($ch, Curlopt_cookiejar, Cookiejar); curl_setopt ($ch, CurloPt_header, 1); curl_setopt ($ch, Curlopt_timeout, TIMEOUT); curl_setopt ($ch, Curlopt_returntransfer, true); $content _2 = curl_exec ($ch); Echo $postfiles; Curl_close ($ch); Get Redicturl link $matches = Array (); Preg_match ('//i ', $content _2, $matches); $url _contiune_2 = $matches [1]; The next link if (! $url _contiune_2) {return false; }//Get mailbox Request Base Read Host $matches = array (); Preg_match ('/(. *?) \/\/(.*?) \/(.*?) /I ', $url _contiune_2, $matches); $url _contiune_3 = Trim ($matches [1]). ' '. Trim ($matches [2]); The site address defined by the home page $url _4 = $url _contiune_3. ' /mail/contactmainlight.aspx?n=435707983 '; The number after n is the random number if (! $url _contiune_3) {return false; } //Fourth step: Start getting mailbox contacts//base $url _4 $ch = Curl_init (); curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_cookiefile, Cookiejar); curl_setopt ($ch, Curlopt_url, $url _4); curl_setopt ($ch, Curlopt_timeout, TIMEOUT); curl_setopt ($ch, Curlopt_returntransfer, true); $str = curl_exec ($ch); Curl_close ($ch); Analyze the data (the data here because of the Hotmail JS processing mechanism, so on the page can not see, the source of data) return $this->hanlde_date ($STR); } function Hanlde_date ($data) {$new _str = array (); if (!empty ($data)) {$ops _start = Stripos ($data, ' ic_control_data '); $ops _end = Stripos ($data, '; ', $ops _start); $new _str = substr ($data, $ops _start + strlen (' Ic_control_data = '), $ops _end-$ops _start-strlen (' ic_control_data = ')) ; return $new _str; Returns the JSON object} else {return array (); }}} $msn = new MSN (); $res = $msn->getaddresslist (' Usrname@ho Tmail.com ', ' 111111 ');? >