In bash, this code posts String to post
to http://www.example.com/target
:
curl -d "String to post" "http://www.example.com/target"
NOTE: You should use http://www.example.com/target
as the URL to POST
to, without any change.
I think all other languages that I have knowledge in need a lot more code than this. I'm not blaming other languages. Let's see the interesting answers that reduce the effort.
Your task is to write the shortest code possible to send a POST
request to a sample server, http://www.example.com/target
, and the request data should be the string String to post
.
POST http://www.example.com/target<<<'String to send'
. (POST
is either a stand-alone script or symlink tolwp-request
, a command line tool delivered with the LWPperl
module.) \$\endgroup\$