How do I make a POST request with curl command line tool?

41 accepted
curl -d "param1=value1&param2=value2" http://example.com/resource.cgi


curl -F "fileupload=@filename.txt" http://example.com/resource.cgi

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.


curl -d "name=Rafael%20Sagula&phone=3320780" http://www.where.com/guest.cgi is the example found in the Curl Example Manual that can be found here : http://www.cs.sunysb.edu/documentation/curl/index.html


curl -X POST http://example.com


curl -d "param=value&param2=value2" "http://www.mysite.com/page.php"


curl -d foo=bar http://example.org/post-url

curl -v --data-ascii var=value http://example.com

there are many more options, check curl --help for more info


This is trivially answered with any search engine.


Right now, if you type How do I make a POST request with curl into Google, the very first hit leads to a tutorial that not only answers the question, but is a great deal more informative than this page on Stack Overflow.

Using Stack Overflow as a substitute for a job that search engines can do very well is pointless. How about using Stack Overflow for questions that can't be answered by a search engine easily?