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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:51:06
Original
1187 people have browsed it

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

<br />
<?php<br />
<br />
<br />
<br />
$qqname='';//这里填写帐号<br />
$qqpassword='';//这里填写密码<br />
<br />
if(!file_exists('./temp')){<br />
	mkdir('./temp');<br />
	}<br />
<br />
<br />
<br />
$cookie_file    =    tempnam('./temp','cookie');<br />
$login_url        =    'http://ptlogin2.qq.com/login';<br />
$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=';<br />
<br />
$ch = curl_init($login_url);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_POST, 1);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);<br />
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);<br />
curl_exec($ch);<br />
curl_close($ch);<br />
<br />
<br />
$url='http://imgcache.qq.com/qzone/v5/loginsucc.html?para=izone';<br />
$ch = curl_init($url);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);<br />
curl_exec($ch);<br />
//preg_match("/<li>  (.*)<\/li>/",$contents,$arr);<br />
curl_close($ch);<br />
<br />
<br />
<br />
$url='http://user.qzone.qq.com/'.$qqname;<br />
$ch = curl_init($url);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);<br />
$contents = curl_exec($ch);<br />
//preg_match("/<li>  (.*)<\/li>/",$contents,$arr);<br />
echo $contents;<br />
curl_close($ch);<br />
<br />
?><br />
<br />
Copy after login

------解决方案--------------------
调试下

Related labels:
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