curl_formget.3 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .\" You can view this file with:
  2. .\" nroff -man [file]
  3. .\" $Id$
  4. .\"
  5. .TH curl_formget 3 "20 June 2006" "libcurl 7.15.5" "libcurl Manual"
  6. .SH NAME
  7. curl_formget - serialize a previously built multipart/formdata HTTP POST chain
  8. .SH SYNOPSIS
  9. .B #include <curl/curl.h>
  10. .sp
  11. .BI "void curl_formget(struct curl_httppost *" form, " void *" arg,
  12. .BI " curl_formget_callback " append ");"
  13. .ad
  14. .SH DESCRIPTION
  15. curl_formget() is used to serialize data previously built/appended with
  16. \fIcurl_formadd(3)\fP. Accepts a void pointer as second argument which will be
  17. passed to the curl_formget_callback function.
  18. .BI "typedef size_t (*curl_formget_callback)(void *" arg, " const char *" buf,
  19. .BI " size_t " len ");"
  20. .nf
  21. The curl_formget_callback will be executed for each part of the HTTP POST
  22. chain. The void *arg pointer will be the one passed as second argument to
  23. curl_formget(). The character buffer passed to it must not be freed. The
  24. callback should return the buffer length passed to it on success.
  25. .SH RETURN VALUE
  26. 0 means everything was ok, non-zero means an error occurred
  27. .SH EXAMPLE
  28. .nf
  29. size_t print_httppost_callback(void *arg, const char *buf, size_t len)
  30. {
  31. fwrite(buf, len, 1, stdout);
  32. (*(size_t *) arg) += len;
  33. return len;
  34. }
  35. size_t print_httppost(struct curl_httppost *post)
  36. {
  37. size_t total_size = 0;
  38. if(curl_formget(post, &total_size, print_httppost_callback)) {
  39. return (size_t) -1;
  40. }
  41. return total_size;
  42. }
  43. .SH AVAILABILITY
  44. This function was added in libcurl 7.15.5
  45. .SH "SEE ALSO"
  46. .BR curl_formadd "(3) "