Introduction to the curl_easy_setopt Function

Source: Internet
Author: User

This section describes http-related parameters in curl_easy_setopt. Note that this section describes libcurl as the subject and others as the object.
1. curlopt_url
Set access URL
2. curlopt_writefunction, curlopt_writedata
The callback function is prototype: size_t function (void * PTR, size_t size, size_t nmemb, void * stream). The function will be called after libcurl receives data, therefore, functions do more data storage functions, such as processing downloaded files. Curlopt_writedata is used to indicate the source of the stream pointer in the curlopt_writefunction function.
3. curlopt_headerfunction, curlopt_headerdata
The prototype of the callback function is size_t function (void * PTR, size_t size, size_t nmemb, void * stream). Once the libcurl receives the HTTP header data, it will call this function. Curlopt_writedata passes the pointer to libcurl, which indicates the source of the stream pointer of the curlopt_headerfunction.
4. curlopt_readfunction curlopt_readdata
When libcurl needs to read data and pass it to the remote host, it will call the function specified by curlopt_readfunction. The function prototype is size_t function (void * PTR, size_t size, size_t nmemb, void * stream ). curlopt_readdata indicates the stream pointer source in the curlopt_readfunction prototype.
5. curlopt_noprogress, curlopt_progressfunction, curlopt_progressdata
Parameters related to the data transmission progress. The function specified by curlopt_progressfunction is normally called by libcurl every second. To make curlopt_progressfunction called, the parameter must be set to false. The parameter specified by curlopt_progressdata will be the first parameter of the function specified by curlopt_progressfunction.
6. curlopt_timeout, curlopt_connectiontimeout:
Curlopt_timeout: Because the transmission time is set, curlopt_connectiontimeout sets the connection wait time.
7. curlopt_followlocation
Set relocation URL
Curlopt_range: curlopt_resume_from:
Resumable upload settings. Curlopt_range specifies that the char * parameter is passed to libcurl to specify the range header of the HTTP domain, for example:
Indicates the first 500 Bytes: bytes = 0-499
Indicates the second 500 Bytes: bytes = 500-999
Indicates the last 500 Bytes: bytes =-500
Indicates the range after 500 Bytes: bytes = 500-
First and last Bytes: bytes = 0-0,-1
Specify the following ranges: bytes = 500-600,601-999.
Curlopt_resume_from transmits a long parameter to libcurl, specifying
Offset.

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.