Skip to content

bbhavsar/easy_curl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple C++ curl library wrapping libcurl

This is the EasyCurl implementation taken from the Apache Kudu repository to be able to use the library by itself without any other dependencies.

It supports basic HTTP and username/password based authentication. Only GET and POST HTTP methods are supported.

Steps to build and install the library libeasy_curl.so along with the header easy_curl.h.

git clone https://github.com/bbhavsar/easy_curl.git
cd easy_curl
mkdir build/
cd build
cmake ..
make
sudo make install

To compile your application linking easy_curl library:

g++ my_app.cc -o my_app.out -leasy_curl

To run the application:

./my_app.out

Sample GET application:

#include <easy_curl.h>
#include <iostream>

using namespace std;

int main() {
  EasyCurl ec;
  string resp;
  auto e = ec.FetchURL("http://localhost:40080/sample_get", &resp);
  if (e.code != kOk) {
    cout << "Error fetching data: " << e.msg << endl;
  }               
  cout << resp << endl;
  return 0;                                                       
}

NOTE: If you don't have permissions to copy the library and header to default library and include paths, then you can use the LD_LIBRARY_PATH environment variable while linking and running the application. See this post for details.

About

Simple C++ HTTP library wrapping libcurl

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published