CURLOPT_HTTPGET.3 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .\" generated by cd2nroff 0.1 from CURLOPT_HTTPGET.md
  2. .TH CURLOPT_HTTPGET 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_HTTPGET \- ask for an HTTP GET request
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPGET, long useget);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long. If \fIuseget\fP is 1, this forces the HTTP request to get back to
  12. using GET. Usable if a POST, HEAD, PUT, etc has been used previously using the
  13. same curl \fIhandle\fP.
  14. When setting \fICURLOPT_HTTPGET(3)\fP to 1, libcurl automatically sets
  15. \fICURLOPT_NOBODY(3)\fP to 0 and \fICURLOPT_UPLOAD(3)\fP to 0.
  16. Setting this option to zero has no effect. Applications need to explicitly
  17. select which HTTP request method to use, they cannot deselect a method. To
  18. reset a handle to default method, consider \fIcurl_easy_reset(3)\fP.
  19. .SH DEFAULT
  20. 0
  21. .SH PROTOCOLS
  22. This functionality affects http only
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. CURL *curl = curl_easy_init();
  28. if(curl) {
  29. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  30. /* use a GET to fetch this */
  31. curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
  32. /* Perform the request */
  33. curl_easy_perform(curl);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.8.1
  39. .SH RETURN VALUE
  40. Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
  41. .SH SEE ALSO
  42. .BR CURLOPT_NOBODY (3),
  43. .BR CURLOPT_POST (3),
  44. .BR CURLOPT_UPLOAD (3),
  45. .BR curl_easy_reset (3)