PHP头条
热点:

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


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





$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>/",$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>/",$contents,$arr);
    echo $contents;
    curl_close($ch);

    ?>


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

    www.phpzy.comtrue/phprm/32183.htmlTechArticlephp模拟登录qq空间,用的curl,帮忙看下错哪了 php模拟登录qq空间,用的curl,帮忙看下哪里错了 php模拟登录qq空间,用的curl,帮忙看下哪里错了,就是不能直接获取登录后的页面信息(包...

    相关文章

    PHP之友评论

    今天推荐