How does PHP simulate login to the school personal portal?

Source: Internet
Author: User
Keywords fportal ctgu 15872474165 2010138112 edu
https:// Sso.ctgu.edu.cn:7002/ca s/login?service=http%3a%2f%2fportal.ctgu.edu.cn%2fportal%2findex.jsp

User name: 2010138112
Password: 15872474165

As shown in title, the demo login gets personal information. Ask the master to give the source code

Reply content:

Laxatives
The proposal is written in a question together with the remuneration. Before writing one, basically and your needs are the same, give you reference yourself to write it.

Crawl/identifycode at Master Tairy/crawl GitHub

This kind of simulation landing is actually very simple, the PHP word mainly uses curl to realize. A closer look at the station you are going to catch the specific how to implement the user login, you can use Wireshark or Burpsuite (recommended with the latter) to grasp the package to see the whole process has that several requests, each request sent what data, the construction of a good to send him can be achieved login.

After that, it's easy to get personal information, find PHP parsing HTML library, or the simplest and most brutal is the string intercept function home plus expression, the data you want to extract out of the good.

For the verification code you give is very easy to identify the verification code, the basic principle of recognition of the use of canvas for verification Code identification

Of course, compared to the problem of egg pain is the page coding problems, often crawling all garbled, online looking for the method of transcoding, all try, this is a metaphysical, can be successful to see your character and patience.

I this repo inside basically realized the above a set of flow, you can refer to write it!

Finally want to say is, crawl or use Python, request+beautifulsoup is not generally useful. Doing this PHP is really not good. Although I still think PHP is the best language in the world!!! (If you want to use Python or something else to read the other directories in my repo, I write them clearly in the readme). Previously wrote a simulation login to our school portal PHP program, was mainly to crawl students score information calculated credits, and our portal does not verify the password, so it is a lot simpler, because you have this verification code, will involve the identification of the image verification code, I'm afraid you have to find a high recognition algorithm to get it done, I simply say the steps of the simulation login, analysis of the login process of your Web page, find the login form, and then the account, password and verification code parameters are filled out to submit the form, and then step by step analysis of the login process, the general will jump several times, There may also be a cross-domain jump, so it is best to update the cookie every time, until you go to the page that needs information, and every time you get the page remember to bring a cookie ... Use a mainstream browser like Firefox,chrome,safari to look at the request header.
Then use PHP's curl to simulate the request.
curl_setopt ($ch, Curlopt_httpheader, $HttpHeaderArray); This kind of problem should go to Google Baidu, rather than in this mention, online a lot of answers curl, make a cookie, set the browser logo, There is what referer, your question does not sound very difficult, write up don't know that website to prevent automatic landing code exactly what, want a try, especially some Ajax operation, parameters wrapped in a bunch of JS, less pass a parameter give you an error, in the end is a manual work. After the poke opened and found a verification code, OK ... You have to add a step verification code to identify the module, and then all post to the interface should be able to do the simple way is to use curl, will not first Baidu, one night how to figure out. Then first use the browser to grasp the packet analysis, to understand the request and response, and then you can write code to achieve. The verification code can write the recognition algorithm, write it, can't write it, take the verification code and hand it in. =_= Crawler Thinking
  • 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.