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