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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:10:56
Original
972 people have browsed it

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

PHP code
<!--

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

-->
<?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>  (.*)/",$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("/
Copy after login
  • (.*)/",$contents,$arr); echo $contents; curl_close($ch); ?>

    ------解决方案--------------------
    调试下
  • 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
    Latest Issues
    curl simulated login
    From 1970-01-01 08:00:00
    0
    0
    0
    Convert cURL command line to PHP cURL code
    From 1970-01-01 08:00:00
    0
    0
    0
    Convert command line cURL to PHP cURL
    From 1970-01-01 08:00:00
    0
    0
    0
    How to set boolean value true in php curl
    From 1970-01-01 08:00:00
    0
    0
    0
    Please tell me, php curl request page shows blank
    From 1970-01-01 08:00:00
    0
    0
    0
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template