Skip to content

libcurl – HTTP,ftp,ssh,telnet,ldap client API

curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.

Quote from http://curl.haxx.se/

Advantages of using libcurl:

  • curl is open source.
  • libcurl API support multiple bindings.
  • libcurl is cross platform that supports windows and *nix.
  • API doc of libcurl are easy to follow, it also provides source code examples.
  • You do not need to read up RFC to code for HTTP post or ftp client, you just need to download libcurl-dev and try it out.

    Let me show you one of the simple example source code from curl official site.

    /*****************************************************************************
     *                                  _   _ ____  _
     *  Project                     ___| | | |  _ \| |
     *                             / __| | | | |_) | |
     *                            | (__| |_| |  _ <| |___
     *                             \___|\___/|_| \_\_____|
     *
     * $Id: simple.c,v 1.6 2004/08/23 14:22:52 bagder Exp $
     */
    
    #include &lt;stdio.h&gt;
    #include &lt;curl/curl.h&gt;
    
    int main(void)
    {
      CURL *curl;
      CURLcode res;
    
      curl = curl_easy_init();
      if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
        res = curl_easy_perform(curl);
    
        /* always cleanup */
        curl_easy_cleanup(curl);
      }
      return 0;
    }
    

    Check out the libcurl tutorial and the sample source codes.

    Categories: Uncategorized.

    Comment Feed

    One Response

    1. Thanks a lot! This really helped!



    Some HTML is OK

    or, reply to this post via trackback.