Web crawler - How does PHP simulate logging into a site with a verification code through curl and crawl data?

WBOY
Release: 2016-08-04 09:19:44
Original
2576 people have browsed it

Now we need to simulate logging into a site with a verification code (simulate a login page and manually enter the verification code), and collect order data in real time. Can you provide an idea?

  1. Does the verification code image need to be captured by curl with cookies, saved locally, and then displayed on the page?
    2. My current approach is to simulate the verification code image on the login page and directly set the src of img as a remote link. This seems to cause the local cookies I capture to be inconsistent with the cookies cached by the browser, and the login result will show login timeout

Reply content:

Now we need to simulate logging into a site with a verification code (simulate a login page and manually enter the verification code), and collect order data in real time. Can you provide an idea?

  1. Does the verification code image need to be captured by curl with cookies, saved locally, and then displayed on the page?
    2. My current approach is to simulate the verification code image on the login page and directly set the src of img as a remote link. This seems to cause the local cookies I capture to be inconsistent with the cookies cached by the browser, and the login result will show login timeout

Generally speaking, you need to visit the login page, save the cookie, use this cookie to request the verification code, and then post the account number, password, cookie, and verification code together

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template