1CURLOPT_HTTPGET(3)         curl_easy_setopt options         CURLOPT_HTTPGET(3)
2
3
4

NAME

6       CURLOPT_HTTPGET - ask for an HTTP GET request
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget);
12

DESCRIPTION

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  curl_easy_re‐
24       set(3).
25

DEFAULT

27       0
28

PROTOCOLS

30       HTTP(S)
31

EXAMPLE

33       curl = curl_easy_init();
34       if(curl) {
35         curl_easy_setopt(curl, CURLOPT_URL, "https://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

AVAILABILITY

45       Along with HTTP
46

RETURN VALUE

48       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
49

SEE ALSO

51       CURLOPT_NOBODY(3),  CURLOPT_UPLOAD(3),  CURLOPT_POST(3),  curl_easy_re‐
52       set(3)
53
54
55
56libcurl 7.85.0                   May 17, 2022               CURLOPT_HTTPGET(3)
Impressum