realize the effect of landing micro-blog and collect micro-blog information
Effect Display:
This is a few days to get a message from Sina Weibo @ me, without a third party login, so only through the analog login to obtain information, the study of the discovery of direct analog login microblogging is more difficult to verify the algorithm is more complex, so the bypass through the login Sina pass to get a cookie to obtain information, the code is as follows.
<?php header (' Content-type:text/html;charset=utf-8 ');
Microblogging login Address $loginUrl = ' https://login.sina.com.cn/sso/login.php?client=ssologin.js (v1.4.15) &_=1403138799543 '; Create a cookie directory under the current file and the corresponding TXT file $cookie _file1 = dirname (__file__). '
/cookie/cookie1.txt '; $cookie _file2 = dirname (__file__). '
/cookie/cookie2.txt '; $cookie _file3 = dirname (__file__). '
/cookie/cookie3.txt ';
$u = ' Weibo username ';
$p = ' micro-blog password ';
$username = Base64_encode ($u);
$password = $p;
Login to Sina passport $loginData [' entry '] = ' SSO ';
$loginData [' gateway '] = ' 1 ';
$loginData [' from '] = ' null ';
$loginData [' savestate '] = ' 30 ';
$loginData [' useticket '] = ' 0 ';
$loginData [' pagerefer '] = ';
$loginData [' vsnf '] = ' 1 ';
$loginData [' su '] = Base64_encode ($u);
$loginData [' service '] = ' SSO ';
$loginData [' sp '] = $password;
$loginData [' sr '] = ' 1920*1080 ';
$loginData [' encoding '] = ' UTF-8 ';
$loginData [' cdult '] = ' 3 ';
$loginData [' domain '] = ' sina.com.cn ';
$loginData [' prelt '] = ' 0 ';
$loginData [' returntype '] = ' TEXT '; $login = Json_decode (Loginpost ($LOGINURL, $loginData), true);
Var_dump ($login);
Get the microblogging cookie $ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $login [' crossdomainurllist '][0]);
curl_setopt ($ch, Curlopt_ssl_verifypeer, 0);
curl_setopt ($ch, Curlopt_ssl_verifyhost, 2);
curl_setopt ($ch, curlopt_header,0);
curl_setopt ($ch, curlopt_returntransfer,1);
curl_setopt ($ch, Curlopt_cookiefile, $cookie _file1);
curl_setopt ($ch, Curlopt_cookiejar, $cookie _file2);
$return = curl_exec ($ch);
Curl_close ($ch);
Login to Weibo by getting cookies, auto jump $ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, "http://weibo.com/5589516034/profile?topnav=1&wvr=6&is_all=1");
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_cookiefile, $cookie _file2);
curl_setopt ($ch, Curlopt_cookiejar, $cookie _file3);
curl_setopt ($ch, curlopt_followlocation, 1);
$return = curl_exec ($ch);
$info = Curl_getinfo ($ch);
Curl_close ($ch);
Echo $return;
function Loginpost ($url, $data) {global $cookie _file1; Echo $cookie _fiLe; exit;
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, curlopt_returntransfer,1);
curl_setopt ($ch, Curlopt_ssl_verifypeer, false);
curl_setopt ($ch, Curlopt_ssl_verifyhost, false);
curl_setopt ($ch, curlopt_post,1);
curl_setopt ($ch, Curlopt_postfields, Http_build_query ($data));
curl_setopt ($ch, Curlopt_cookiejar, $cookie _file1);
$return = curl_exec ($ch);
$info = Curl_getinfo ($ch);
Curl_close ($ch);
return $return; }?>