1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_HTTPGET 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_NOBODY (3) 9 - CURLOPT_POST (3) 10 - CURLOPT_UPLOAD (3) 11 - curl_easy_reset (3) 12--- 13 14# NAME 15 16CURLOPT_HTTPGET - ask for an HTTP GET request 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget); 24~~~ 25 26# DESCRIPTION 27 28Pass a long. If *useget* is 1, this forces the HTTP request to get back to 29using GET. Usable if a POST, HEAD, PUT, etc has been used previously using the 30same curl *handle*. 31 32When setting CURLOPT_HTTPGET(3) to 1, libcurl automatically sets 33CURLOPT_NOBODY(3) to 0 and CURLOPT_UPLOAD(3) to 0. 34 35Setting this option to zero has no effect. Applications need to explicitly 36select which HTTP request method to use, they cannot deselect a method. To 37reset a handle to default method, consider curl_easy_reset(3). 38 39# DEFAULT 40 410 42 43# PROTOCOLS 44 45HTTP(S) 46 47# EXAMPLE 48 49~~~c 50int main(void) 51{ 52 CURL *curl = curl_easy_init(); 53 if(curl) { 54 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 55 56 /* use a GET to fetch this */ 57 curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); 58 59 /* Perform the request */ 60 curl_easy_perform(curl); 61 } 62} 63~~~ 64 65# AVAILABILITY 66 67Along with HTTP 68 69# RETURN VALUE 70 71Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. 72