CURL模拟登陆SINA微博有关问题

php中文网
发布: 2016-06-13 13:26:02
原创
1110人浏览过

CURL模拟登陆SINA微博问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><?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);
?>


登录后复制



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

------解决方案--------------------
http://www.jb51.net/article/29486.htm 看看这个
相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号