cpr library-Introduction














































cpr library-Introduction



cpr-Introduction


cpr is a modern HTTP library for C++, built for people.It is a simple wrapper around libcurl inspired by the python requests project.

Despite its name, libcurl's easy interface is anything but making mistakes misusing it is a common source of error which can be frustrating. Using the more expressive language facilities of C++11, this library captures the essence of making network calls into a few concise idioms.

C++ Requests is designed to be as simple and pleasant to use as possible. HTTP method through the primary API are for limited time and stateless.On the other hand,this library firmly believes that Resource Acquisition Is Initialization. Cleanup is as easy and intuitive as letting an object fall out of scope. You would not find any init() or close() methods here, and proper use of this library requires neither delete nor free.

Example of GET request:



Without using it can be more complicated and also less functional.

Features of cpr library:

Till now,C++ Requests currently supports(including advanced usage:

  • PUT methods
  • DELETE methods
  • HEAD methods
  • OPTIONS methods
  • PATCH methods
  • Custom headers
  • Url encoded parameters and POST values.
  • Multipart form POST upload
  • File POST upload
  • Digest authentication
  • Connection and request timeout specification
  • Proxy support
  • Callback interface
Advantages:
    • It is a very simple and easy to use.
    • Cleanup is as easy and intuitive as letting an object fall out of scope.
    • This library also does not require neither delete or free for proper use.

    Requirements:

    • A C++11 compatible compiler such as Clang or GCC.
    • curl and its development libraries.


    More Articles of ayush srivastava:

    Name Views Likes
    cpp-netlib Introduction 414 0
    cpr library-Introduction 1117 0

    Comments