mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 00:02:52 +08:00
Added correct headers for the Daemon to POST json content
This commit is contained in:
@@ -450,11 +450,19 @@ bool uploadPost(std::string url, std::string data)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
struct curl_slist *headers=NULL; // init to NULL is important
|
||||||
|
|
||||||
|
/* Add the required headers */
|
||||||
|
headers = curl_slist_append(headers, "Accept: application/json");
|
||||||
|
headers = curl_slist_append( headers, "Content-Type: application/json");
|
||||||
|
headers = curl_slist_append( headers, "charsets: utf-8");
|
||||||
|
|
||||||
/* get a curl handle */
|
/* get a curl handle */
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
if(curl) {
|
if(curl) {
|
||||||
|
/* Add the headers */
|
||||||
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||||
|
|
||||||
/* First set the URL that is about to receive our POST. This URL can
|
/* First set the URL that is about to receive our POST. This URL can
|
||||||
just as well be a https:// URL if that is what should receive the
|
just as well be a https:// URL if that is what should receive the
|
||||||
data. */
|
data. */
|
||||||
|
Reference in New Issue
Block a user