Php simulates logon to the QQ space and uses the curl to help you identify the error.

Source: Internet
Author: User
Php simulates logon to the QQ space, uses curl to help you see where the php simulates logon to the QQ space, and uses curl to help you see what went wrong, that is, you cannot directly obtain the page information after logon (including the personal homepage information after logon) & lt ;? Php $ qqname = ''; // enter the account $ qqpasswor php here to simulate logon to the QQ space. use the curl to help you see what went wrong.
Php simulates logon to the QQ space and uses the curl to help you see what is wrong, that is, you cannot directly obtain the information on the logon page (including the personal homepage information after logon)





$ Qqname = ''; // enter the account here
$ Qqpassword = ''; // enter the password here

If (! File_exists ('./temp ')){
Mkdir ('./temp ');
}



$ Cookie_file = tempnam ('./temp', 'cooker ');
$ 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/'.w.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 );

    ?>


  • ------ Solution --------------------
    Debug

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.