Use php to implement simulated login of Zhengfang educational administration system

Source: Internet
Author: User
: This article describes how to use php to implement simulated login to the Zhengfang educational administration system. if you are interested in the PHP Tutorial, refer to it. The first time I used php to implement simulated login, it was really a long time, but it was quite interesting that it was just a little time to explore it at 1.1 points. Why can I log on without submitting the verification code? it may be a bug!

To achieve simulated login, first open the browser to log on to the website you want to simulate login, and then press F12 to find the data to be submitted for simulated login, for example, there is a hidden _ VIEWSTATE variable in the square that needs to be matched with a regular expression to find the value of this variable, after logging in, you will find your personal information on the page and save your cookie in the code to jump to another page you want to query. my code is the method to query the score, if you are interested, you can discuss with me!

 $ Result, 'txtusername' => $ username, 'textbox2 '=> $ password, 'radiobuttonlist1' => iconv ('utf-8', 'gb2312 ', 'Student '), 'button1' => ''); $ filecookie = dirname (_ FILE __). "/cookie"; $ ch2 = curl_init (); curl_setopt ($ ch2, CURLOPT_URL, $ url); curl_setopt ($ ch2, success, 1); curl_setopt ($ ch2, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ ch2, CURLOPT_POST, 1); curl_setopt ($ ch2, CURLOPT_POSTFIELDS, http_build _ Query ($ post1); curl_setopt ($ ch2, CURLOPT_COOKIEJAR, $ filecookie); // Save the login cookie information to curl_exec ($ ch2) in the filecookie file ); curl_close ($ ch2); // Obtain the simulated logon score page _ VIEWSTATE $ ch3 = curl_init (); curl_setopt ($ ch3, CURLOPT_URL, "http://jw.jxust.edu.cn/xscj_gc.aspx? Xh = $ username & gnmkdm = N121605 "); curl_setopt ($ ch3, success, 1); curl_setopt ($ ch3, CURLOPT_COOKIEFILE, $ filecookie); curl_setopt ($ ch3, success, success, "http://jw.jxust.edu.cn"); $ data = curl_exec ($ ch3); curl_close ($ ch3); $ pattern = '/$ Cj _ VIEWSTATE, 'ddlxn '=> '', 'ddlxq' =>'', 'button1' => iconv ('utf-8', 'gb2312 ', 'query by semesters '); curl_setopt ($ methane, CURLOPT_RETURNTRANSFER, 0); curl_setopt ($ methane, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ methane, CURLOPT_COOKIEFILE, $ filecookie ); curl_setopt ($ methane, CURLOPT_POST, 1); curl_setopt ($ methane, CURLOPT_POSTFIELDS, $ post2); curl_setopt ($ methane, CURLOPT_REFERER, "http://jw.jxust.edu.cn "); $ data = curl_exec ($ methane );/ /Preg_match_all ($ pattern, $ data, $ matches); curl_close ($ methane);?>

The above describes how to use php to implement simulated login to the Zhengfang educational administration system, including some content, and hope to help friends who are interested in PHP tutorials.

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.