migrated from stackoverflow.com Jun 6 '10 at 7:46
This question came from our site for professional and enthusiast programmers.
663
+50
|
or
For more information see the cURL manual. You might also find the cURL tutorial on emulating a web browser helpful.
With libcurl, you'd use the
curl_formadd() function to build your form before submitting it in the usual way. See the libcurl documentation for more information. | |||
add comment |
207
|
For a RESTful HTTP POST containing XML:
or for JSON, use this:
This will read the contents of file named
filename.txt and send it as the post request. | ||||||||||||||||||||
|
24
|
is the example found in the Curl Example Manual.
Use %26 for the ampersands though if the above doesn't work:
| |||
add comment |
19
|
If you want to login to a site, do the following:
The first request saves the session cookie (that is provided upon successful login) in the "headers" file. From now on you can use that cookie to authenticate you to any part of the website that you usually access after logging in with a browser.
| ||||
|
13
|
and there are many more options, check
curl --help for more information. | |||
add comment |
--data-urlencode
(no dash), in recent versions at least – waitinforatrain Feb 12 '13 at 12:34--data ''
works if there is no POST data, but the recipient requires a request to be POSTed. – Daniel Beck♦ Apr 27 '13 at 13:15