Skip to content

Instantly share code, notes, and snippets.

@th3terrorist
Last active June 7, 2021 16:37
Show Gist options
  • Save th3terrorist/adbfe993d727423b7ef7d9d2000ac967 to your computer and use it in GitHub Desktop.
Save th3terrorist/adbfe993d727423b7ef7d9d2000ac967 to your computer and use it in GitHub Desktop.
a simple curl req for later
#include <iostream>
#include <string>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
std::string url = "http://httpbin.org/post";
if(curl)
{
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "none=none");
auto res = curl_easy_perform(curl);
if(res != CURLE_OK)
std::cout<<"curl error \n";
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment