Skip to content
/ cppurl Public

A very simple, header only C++ wrapper for cURL

Notifications You must be signed in to change notification settings

mr5z/cppurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

A very simple, header only, asynchronous C++ wrapper for cURL

An example usage would be:

#include <iostream>
#include "cppurl.hpp"

int main(int argc, char* argv[]) {

	CppUrl httpClient1, httpClient2;

	httpClient1.get("http://smokedetector.esy.es/api/update-alerts.php?alertIds=123123,123123", 
		[](CURLcode code, const std::string &response) {
		std::cout << "CURLcode: " << code << ", (update alerts)response: " << response << std::endl;
	}).async();

	std::map<std::string, std::string> files;

	files["image1"] = "C:\\Users\\mr5\\Desktop\\image.png";
	files["image2"] = "C:\\Users\\mr5\\Desktop\\plant1.jpg";

	httpClient2.post("http://smokedetector.esy.es/api/insert-image.php", files,
		[](CURLcode code, const std::string &response) {
		std::cout << "CURLcode: " << code << ", (insert alerts)response: " << response << std::endl;
	}).execute();

	std::cout << "hey";

	std::cin.get();
}

About

A very simple, header only C++ wrapper for cURL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages