About libcurl simulated submission form, libcurl submitted form
Because I do not know much about the web mechanism, I have encountered many problems in using C/libcurl. Main solution:
1. Locate the submitted form in the source code of the webpage. That is, the action attribute in the form corresponding to the webpage file. It is often submitted to jsp, php, and other scripts, rather than directly submitted to this page.
2. Pay attention to the http header. Different http headers may cause different webpage responses. When I submit a php script to two URLs for a small project, the php script execution is incorrect because of the http header.
3. Redirection problems.
In some webpages, the returned webpage Data carries redirection information. You need to enable curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, true );
As I currently know, this parameter will automatically track redirection in the http header. The reason for this is that the redirection has a timeout parameter. If the link fails,
It also causes webpage execution problems.
4. For https, you must add openssl support when compiling libcurl.
5. Add curl_easy_setopt (curl, CURLOPT_VERBOSE, 1L) to the Code to track the data transmission status.
6. If the problem persists, use Fiddler to capture packets. Compared with wireshark, Fiddler can capture https packets more conveniently and quickly.
Finally, I would like to emphasize article 6:Fiddler can more easily capture https, and can easily solve various problems encountered by comparing different packages.