About libcurl simulated submission form, libcurl submitted form

Source: Internet
Author: User

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.

Related Article

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.