1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include <stdio.h>
- #include <curl/curl.h>
- int main(void)
- {
- CURL *curl;
- CURLcode res = CURLE_OK;
- struct curl_slist *host = NULL;
-
- host = curl_slist_append(NULL, "example.com:80:127.0.0.1");
- curl = curl_easy_init();
- if(curl) {
- curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
- curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
- res = curl_easy_perform(curl);
-
- curl_easy_cleanup(curl);
- }
- curl_slist_free_all(host);
- return (int)res;
- }
|