| r10 vs r11 | ||
|---|---|---|
| ... | ... | |
| 42 | 42 | } |
| 43 | 43 | } }}} |
| 44 | 44 | {{{#!syntax cpp |
| 45 | #include <iostream> | |
| 46 | #include <string> | |
| 47 | #include <curl/curl.h> | |
| 45 | 48 | |
| 49 | size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* buffer) { | |
| 50 | size_t totalSize = size * nmemb; | |
| 51 | buffer->append((char*)contents, totalSize); | |
| 52 | return totalSize; | |
| 53 | } | |
| 54 | ||
| 55 | int main() { | |
| 56 | CURL* curl; | |
| 57 | CURLcode res; | |
| 58 | std::string response; | |
| 59 | ||
| 60 | curl = curl_easy_init(); | |
| 61 | ||
| 62 | if (curl) { | |
| 63 | curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com"); | |
| 64 | ||
| 65 | ||
| 66 | curl_easy_setopt(curl, CURLOPT_POST, 1L); | |
| 67 | ||
| 68 | ||
| 69 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); | |
| 70 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); | |
| 71 | ||
| 72 | ||
| 73 | res = curl_easy_perform(curl); | |
| 74 | ||
| 75 | ||
| 76 | std::cout << "Response Code: " << res << std::endl; | |
| 77 | std::cout << "Response Text:\n" << response << std::endl; | |
| 78 | ||
| 79 | curl_easy_cleanup(curl); | |
| 80 | } | |
| 81 | ||
| 82 | return 0; | |
| 83 | } | |
| 46 | 84 | }}} |
| 47 | 85 | |
| 48 | 86 | == 범죄 == |
| ... | ... |