>  기사  >  백엔드 개발  >  CURL模拟登陆SINA微博问题

CURL模拟登陆SINA微博问题

WBOY
WBOY원래의
2016-06-23 14:24:491043검색

<?php$username =base64_encode("xxxxxx@sina.com"); $data = file_get_contents('http://login.sina.com.cn/sso/prelogin.php?entry=miniblog&callback=&user='.$username.'&client=ssologin.js(v1.3.16)');$json = json_decode($data);$pw = strtolower(sha1(strtolower(sha1(strtolower("111111"))).$json->servertime.$json->nonce));$CookieFile = '/sinacookie/'.$username.'_sinacookie.tmp';		$post_data = array(		"entry"=>"weibo",		"gateway"=>"1",		"from"=>"",		"savestate"=>"7",		"useticket"=>"1",		"ssosimplelogin"=>"1",		"username"=>$username, // base 64之后的用户名		"service"=>"miniblog",		"servertime"=>$json->servertime, //上步得到的服务器时间		"nonce"=>$json->nonce, //上步得到随机生成的字符串		"pwencode"=>"wsse",		"password"=>$pw, //加密的密码		"encoding"=>"utf-8",		"url"=>"+ HttpUtility.UrlEncode('http:'//'weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack')",		"returntype"=>"META");		 $ch = curl_init();curl_setopt($ch, CURLOPT_URL, "http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.16)");curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieFile);curl_setopt($ch, CURLOPT_COOKIEFILE, $CookieFile);curl_exec($ch);curl_close($ch);?>



请教怎么登陆不上去呢???用户名和密码都对呀,问题也没提示什么错


回复讨论(解决方案)

sina 不是有现成的api可以调用啊,还要画蛇添足?

成天到晚模拟新浪, 新浪岂是吊死可以模拟的.

http://www.jb51.net/article/29486.htm 看看这个

2楼不适合做技术。

?主解?了??我也想要做新浪的模?登?~求代?。

额 我也没有能实现登录  就是登录到新浪的页面了 我要完成的题目
5、 用PHP的Curl扩展编写一个程序,并调用微博开放API的friends_timeline,update,upload接口获取相应结果
楼主姐姐了没有呢

6楼 解决了吗?

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.