PHP Analog Remote Login

Source: Internet
Author: User

<?php!extension_loaded (' curl ') && die (' The curl extension are not loaded. '); $BASEURL = ' http://127.0.0.1 ';//root address $login _url = $baseUrl. ' /login.php?act=login ';//login page address $get _url = $baseUrl. ' /index.php ';   The page to be collected $post _fields = Array ();   The following two items need to be modified $post _fields[' name '] = ' admin ';      $post _fields[' pass ' = ' 123456 ';   Get form Formhash $ch = Curl_init ($login _url);   curl_setopt ($ch, Curlopt_header, 0);   curl_setopt ($ch, Curlopt_returntransfer, 1);   $contents = curl_exec ($ch);        Curl_close ($ch); Post data, get cookie $cookie _file = dirname (__file__).   '/cookie.txt ';   $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);   Take the cookie above to get the page content you need to log in to see $ch = Curl_init ($get _url); curl_setopt ($ch, Curlopt_headeR, 0);   curl_setopt ($ch, Curlopt_returntransfer, 0);  curl_setopt ($ch, Curlopt_cookiefile, $cookie _file);   $mycontents = curl_exec ($ch);     Curl_close ($ch);    Var_dump ($mycontents);

  

PHP Analog Remote Login

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.