Article 2: using the libcurl C interface (important)

Source: Internet
Author: User
Tags form post visual studio 2010
Using the libcurl C interface

There's the tutorial to start with, read the tutorial to get a general in-depth grip of what libcurl programming is all about.

There is an overview article that provides a deep understanding of libcurl programming by reading the tutorial.

There are some example C source codes you can check out. They're not all-covering or even very extensive, but they might serve as a source of inspiration to start hacking.

In addition, you can also learn libcurl in example C source codes.

Dig into the symbols in versions document to learn in which libcurl releases symbols were added or removed.

Windows developers using Microsoft Visual Studio, might enjoy:

  • Andrei Jakab's using libcurl with SSH support in Visual Studio 2010 [PDF]
  • Rosso salmanzadeh's using libcurl in Visual Studio [PDF] guide.
Easy or multi

The easy interface is a synchronous, efficient, quickly used and... Yes, easy interface for file transfers. Numerous applications have been built using this.

The Multi interface is the asynchronous brother in the family and it also offers multiple transfers using a single thread and more. Get a grip of how to work with it in
Multi interface overview.

Easy interface is synchronous, efficient, and easy to use, and easy interface is used for file transmission. A large number of applications use easy interfaces.

Multi interfaces are asynchronous and provide multiple transmission times using a single thread or multiple threads. You can read the multi interface overview to understand how multi interface works.

The easy interface

When using libcurl you Init (libcurl
-Curl_global_init () Your easy-session and get a handle, which you use as input to the following interface functions you use.

You continue by setting all the options you want in the upcoming transfer, most important among them is the URL itself. You might want to set some callbacks
Well that will be called from the library when data is available etc.

When all is setup, you tell libcurl to perform the transfer. It will then do the entire operation and won't return until it is done or failed.

After the performance is made, you may get information about the transfer and then you cleanup
Easy-session's handle and libcurl is entire off the hook!

When using libcurl, you first initialize your easy-session (simple conversation) and obtain a handle. You can use this handle as the input of the subsequent interface function.

Next, you set the options you want in upcoming transfer (the next transmission actually refers to the next connection). The most important of these options is URL. You can also set some callback functions for data processing.

After all these are created, You can execute this transfer. It performs all operations and returns the value only if it is successful or fails.

 

 

See also the easy interface overview.

Curl_easy_init ()
Curl_easy_cleanup ()
Curl_easy_setopt ()
Curl_easy_perform ()
Curl_easy_getinfo ()

While the above functions are the main functions to use in the easy interface, there is a series of other helpful functions too including:

These functions are commonly used in easy interface, and there are a series of other useful functions.

 

Curl_version () Returns a pointer to the libcurl version string
Curl_getdate () Converts a date string to time_t
Curl_formadd () Build multipart form-data posts
Curl_formfree () Free a previusly built form post
Curl_slist_append () Builds a linked list
Curl_slist_free_all () Frees a whole curl_slist as made with curl_slist_append ()
Curl_easy_escape () URL encodes a string
Curl_easy_unescape () URL decodes a string

All man pages are supported in every Release Archive, in three different formats: man page, HTML and PDF.

All the instructions are included in each release. There are three forms: man page, HTML, and PDF.



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.