Home > Article > Backend Development > Web crawler - How does PHP simulate logging into a site with a verification code through curl and crawl data?
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?
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
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?
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