Home > Backend Development > PHP Tutorial > php模拟登录qq空间,用的curl,帮忙看下哪里错了

php模拟登录qq空间,用的curl,帮忙看下哪里错了

WBOY
Release: 2016-06-23 13:35:57
Original
969 people have browsed it

php模拟登录qq空间,用的curl,帮忙看下哪里错了,就是不能直接获取登录后的页面信息(包括登陆后的个人主页信息等)

<?php$qqname='';//这里填写帐号$qqpassword='';//这里填写密码if(!file_exists('./temp')){	mkdir('./temp');	}$cookie_file    =    tempnam('./temp','cookie');$login_url        =    'http://ptlogin2.qq.com/login';$post_fields    =    'u='.$qqname.'&m='.$qqpassword.'&css=http://imgcache.qq.com/ptcss/b2/qzone/15000101/style.css&mibao_css=m_qzone&aid=15000101&u1=http://imgcache.qq.com/qzone/v5/loginsucc.html?para=izone&ptredirect=1&h=1&from_ui=1&dumy=';$ch = curl_init($login_url);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);curl_exec($ch);curl_close($ch);$url='http://imgcache.qq.com/qzone/v5/loginsucc.html?para=izone';$ch = curl_init($url);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);curl_exec($ch);//preg_match("/<li>  (.*)<\/li>/",$contents,$arr);curl_close($ch);$url='http://user.qzone.qq.com/'.$qqname;$ch = curl_init($url);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);$contents = curl_exec($ch);//preg_match("/<li>  (.*)<\/li>/",$contents,$arr);echo $contents;curl_close($ch);?>
Copy after login


回复讨论(解决方案)

有没有知道的??

调试一下,看提示什么错误才好解决呀

有没有知道的??

加个followlocation看看

调试下

QQ相关页面的登陆是get形式的,不是post,所有提交的信息都是通过get方式提交的,但需要注意其登录密码是经过加密处理为32位密文的

QQ相关页面的登陆是get形式的,不是post,所有提交的信息都是通过get方式提交的,但需要注意其登录密码是经过加密处理为32位密文的



有木有什么参考文档类的?
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template