How to work with Amadeus ?
Date: Tue, 8 Sep 2020 11:28:55 +0200
Hi,
I am a newbie to cURL on C++ (Visual Studio 2017).
Any advice how to modify the working sample code below to send
Authorization Request/Response (token) to Amadeus API and than send the
actual Amadeus command ? See
https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
// CurlTest.cpp
#define CURL_STATICLIB
#include <iostream>
#include <string>
#include "curl/curl.h"
static size_t my_write(void* buffer, size_t size, size_t nmemb, void* param)
{
std::string& text = *static_cast<std::string*>(param);
size_t totalsize = size * nmemb;
text.append(static_cast<char*>(buffer), totalsize);
return totalsize;
}
int main()
{
/*std::cout << "Hello World!\n";*/
std::string result;
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://tcno.co/hello.txt");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (CURLE_OK != res) {
std::cerr << "CURL error: " << res << '\n';
}
}
curl_global_cleanup();
std::cout << result << "\n\n";
}
Your kind advice would be highly appreciated.
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-08