PHP Demo Login to the target site, why 302 did not follow the jump. Cookies have been obtained. Ask for doubts.

Source: Internet
Author: User
Keywords Jump PHP Curl Cookie
Jump Phpcurlcookie

 
    $user, ' Password ' = $pass, ' redirectafterloginurl ' = ' https://www.mql5.com/zh ', ' rememberme ' =>false, '// Step 1//Get a cookie$ch = Curl_init () curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_header, 0); Curl_ Setopt ($ch, Curlopt_returntransfer, True); curl_setopt ($ch, Curlopt_cookiejar, $cookie); $content 1 = curl_exec ($ch); Curl_close ($ch);//step 2//post data; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_ HEADER, 0); curl_setopt ($ch, Curlopt_returntransfer, 0); curl_setopt ($ch, Curlopt_cookiejar, $cookie);// Check the SSL encryption algorithm for the presence of curl_setopt ($ch, Curlopt_ssl_verifypeer, false) from the certificate; curl_setopt ($ch, Curlopt_ssl_verifyhost, false); curl_setopt ($ch, Curlopt_connecttimeout, 120);//auto-follow Jump curl_setopt ($ch, curlopt_followlocation, 1); curl_setopt ($ch, Curlopt_autoreferer, 1); curl_setopt ($ch, Curlopt_post, Count ($fields)); curl_setopt ($ch, Curlopt_postfields, HTTP_ Build_query ($fields _post)) $result = Curl_exec ($ch); Curl_close ($ch);
  • 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.