SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
http.h File Reference

HTTP Get/Post functions and others. More...

#include <string>

Go to the source code of this file.

Functions

size_t satdump::curl_write_std_string (void *contents, size_t size, size_t nmemb, std::string *s)
 cURL helper function, writing the payload into a std::string
int satdump::perform_http_request (std::string url, std::string &result, std::string added_header="", float *progress=nullptr)
 Perform a HTTP Request on the provided URL and return the result as a string.
int satdump::perform_http_request_post (std::string url_str, std::string &result, std::string post_req, std::string added_header="")
 Perform a HTTP Request on the provided URL and return the result as a string, with POST data.

Detailed Description

HTTP Get/Post functions and others.

Function Documentation

◆ curl_write_std_string()

size_t satdump::curl_write_std_string ( void * contents,
size_t size,
size_t nmemb,
std::string * s )

cURL helper function, writing the payload into a std::string

Provided a std::string is passed as userdata for Curl, this can be used a handler to write incoming data into said string.

◆ perform_http_request()

int satdump::perform_http_request ( std::string url,
std::string & result,
std::string added_header = "",
float * progress = nullptr )

Perform a HTTP Request on the provided URL and return the result as a string.

Parameters
url_strURL to use
resultHTTP response, as a string
added_headeroptional additional headers
progressoptional progress float pointer

◆ perform_http_request_post()

int satdump::perform_http_request_post ( std::string url_str,
std::string & result,
std::string post_req,
std::string added_header = "" )

Perform a HTTP Request on the provided URL and return the result as a string, with POST data.

Parameters
url_strURL to use
resultHTTP response, as a string
post_reqPOST payload
added_headeroptional additional headers