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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:51:061190Durchsuche

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 />

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn