Skip to content

Commit 9de1639

Browse files
authored
Update package.json
1 parent 4415b63 commit 9de1639

1 file changed

Lines changed: 0 additions & 33 deletions

File tree

Server/package.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +0,0 @@
1-
g++ -o curl_example curl_example.cpp -lcurl
2-
#include <iostream>
3-
#include <string>
4-
#include <curl/curl.h>
5-
6-
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) {
7-
((std::string*)userp)->append((char*)contents, size * nmemb);
8-
return size * nmemb;
9-
}
10-
11-
int main() {
12-
CURL *curl;
13-
CURLcode res;
14-
std::string readBuffer;
15-
16-
curl_global_init(CURL_GLOBAL_DEFAULT);
17-
curl = curl_easy_init();
18-
if(curl) {
19-
curl_easy_setopt(curl, CURLOPT_URL, "https:
20-
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
21-
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
22-
res = curl_easy_perform(curl);
23-
if(res != CURLE_OK) {
24-
std::cerr << "cURL error: " << curl_easy_strerror(res) << std::endl;
25-
} else {
26-
std::cout << readBuffer << std::endl;
27-
}
28-
curl_easy_cleanup(curl);
29-
}
30-
curl_global_cleanup();
31-
return 0;
32-
}
33-
./curl_example

0 commit comments

Comments
 (0)