Last active
June 7, 2021 16:37
-
-
Save th3terrorist/adbfe993d727423b7ef7d9d2000ac967 to your computer and use it in GitHub Desktop.
a simple curl req for later
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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