curl_url.3 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .\" generated by cd2nroff 0.1 from curl_url.md
  2. .TH curl_url 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_url \- create a URL handle
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLU *curl_url();
  9. .fi
  10. .SH DESCRIPTION
  11. This function allocates a URL object and returns a \fICURLU\fP handle for it,
  12. to be used as input to all other URL API functions.
  13. This is a handle to a URL object that holds or can hold URL components for a
  14. single URL. When the object is first created, there is of course no components
  15. stored. They are then set in the object with the \fIcurl_url_set(3)\fP
  16. function.
  17. .SH PROTOCOLS
  18. This functionality affects all supported protocols
  19. .SH EXAMPLE
  20. .nf
  21. int main(void)
  22. {
  23. CURLUcode rc;
  24. CURLU *url = curl_url();
  25. rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
  26. if(!rc) {
  27. char *scheme;
  28. rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0);
  29. if(!rc) {
  30. printf("the scheme is %s\\n", scheme);
  31. curl_free(scheme);
  32. }
  33. curl_url_cleanup(url);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.62.0
  39. .SH RETURN VALUE
  40. Returns a \fBCURLU \fP* if successful, or NULL if out of memory.
  41. .SH SEE ALSO
  42. .BR CURLOPT_CURLU (3),
  43. .BR curl_url_cleanup (3),
  44. .BR curl_url_dup (3),
  45. .BR curl_url_get (3),
  46. .BR curl_url_set (3),
  47. .BR curl_url_strerror (3)