Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <curl.h>
- using namespace std;
- size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp)
- {
- ((string*)userp)->append((char*)contents, size *nmemb);
- return size *nmemb;
- }
- int main(int argc, char** argv)
- {
- CURL *curl = curl_easy_init();
- string got;
- curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.fr");
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, &got);
- curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- cout << "Source code of https://www.google.fr:" << endl << endl << got << endl;
- while(1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement