The curl simulates post data and simulates login to a page. you can use html to write a form post to log on, but you cannot use curl to log on. What is the problem ------ solution ------------------ your error is only executed once & nbsp; curl_exec ($ ch) according to the current login page design, the user login process is: 1. enter the single-page curl of the table to simulate post data problems
Simulate login to a page, write a form in html and post it to log on, but you cannot log on with curl. What is the situation?
------ Solution --------------------
You only performed curl_exec ($ ch) once during your error)
According to the current login page design, the user login process is:
1. enter the table list page. here, the sessionid has been passed in, or
2. fill in the form and submit
3. verify that the user passes the authentication and then reset the cookie.
You only start from step 2, so CURLOPT_COOKIEJAR only obtains the cookie generated in step 3.
Because the cookie in step 1 is missing, the verification fails.
So you need
1. go to the table list page and use CURLOPT_COOKIEJAR to record the cookie
2. go to the form processing page and pass the cookie saved in step 1 through CURLOPT_COOKIEFILE.