1CURLOPT_HTTPGET(3) curl_easy_setopt options CURLOPT_HTTPGET(3)
2
3
4
6 CURLOPT_HTTPGET - ask for an HTTP GET request
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget);
12
14 Pass a long. If useget is 1, this forces the HTTP request to get back
15 to using GET. Usable if a POST, HEAD, PUT, etc has been used previously
16 using the same curl handle.
17
18 When setting CURLOPT_HTTPGET(3) to 1, it will automatically set CUR‐
19 LOPT_NOBODY(3) to 0 and CURLOPT_UPLOAD(3) to 0.
20
21 Setting this option to zero has no effect. Applications need to explic‐
22 itly select which HTTP request method to use, they cannot deselect a
23 method. To reset a handle to default method, consider
24 curl_easy_reset(3).
25
27 0
28
30 HTTP(S)
31
33 curl = curl_easy_init();
34 if(curl) {
35 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
36
37 /* use a GET to fetch this */
38 curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
39
40 /* Perform the request */
41 curl_easy_perform(curl);
42 }
43
45 Along with HTTP
46
48 Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
49
51 CURLOPT_NOBODY(3), CURLOPT_UPLOAD(3), CURLOPT_POST(3),
52 curl_easy_reset(3)
53
54
55
56libcurl 7.64.0 May 21, 2018 CURLOPT_HTTPGET(3)