Created
January 7, 2017 14:52
-
-
Save heidsoft/252842c03d6b69f478d47bfa05fa00cf to your computer and use it in GitHub Desktop.
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 <stdio.h> | |
| #include <curl/curl.h> | |
| int main(void) | |
| { | |
| CURL *curl; | |
| CURLcode res; | |
| struct curl_slist *headers = NULL; | |
| curl = curl_easy_init(); | |
| if(curl) { | |
| headers = curl_slist_append(headers, "Host: www.google.ie"); | |
| headers = curl_slist_append(headers, "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0"); | |
| headers = curl_slist_append(headers, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
| headers = curl_slist_append(headers, "Accept-Language: en-us,en;q=0.5"); | |
| /* Add more headers here */ | |
| curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.ie/"); | |
| curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); | |
| res = curl_easy_perform(curl); | |
| /* always cleanup */ | |
| curl_slist_free_all(headers); | |
| curl_easy_cleanup(curl); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment