← Back

ofxHttpLib

github.com/ffunatsu/ofxHttpLib · @ffunatsu
OF 0.12 Web/Networking

cpp-httplib for openFrameworks

1 0 Last commit 1y ago Created 1y ago

README

ofxHttpLib



cpp-httplib for openFrameworks (tested on v0.12.0, cpp-httplib version: v0.18.1)

Notes



Usage



See example_http_client. (NOTE: Please use projectGenerator before run it)

#include "ofApp.h"

// need this to SSL support, however, openssl is not included in this lib
// if you really need, you have to config openssl (>= 3.0.0) lib by yourself
//#define CPPHTTPLIB_OPENSSL_SUPPORT

// also need this for windows ofxOpenSSL3
//#define USE_OPENSSL3_INSTEAD_OF_OPENSSL_WIN 1

include "httplib.h"

//-------------------------------------------------------------- void ofApp::setup(){ ofLogToConsole(); //httplib::Client cli("https://httpbin.org"); httplib::Client cli("http://httpbin.org"); auto res = cli.Get("/ip"); if (res) { ofLogNotice("ofApp") << "res->status = " << res->status; ofLogNotice("ofApp") << "res->body = " << res->body; } else { ofLogError("ofApp") << "error: " << res.error(); } } // Result: // [notice ] ofApp: res->status = 200 // [notice ] ofApp: res->body = { // "origin": "xxx.xxx.xxx.xxx" // }


LICENSE



NOTE: No specific copyright is claimed for this repository changes (for oF binding), but the Apache License 2.0 or MIT License can be applied if necessary.

Get this addon

HTTPS
SSH