Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing the response content body when using curl to post data

Tags:

curl

ubuntu

I'm using the command below on ubuntu:

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"foo":"bar"}'  http://localhost:8888/

The following is the response received:

< HTTP/1.1 200 OK
< Content-Length: 3
< Content-Type: text/html; charset=UTF-8
< Server: TornadoServer/2.1
<
* Connection #0 to host localhost left intact
* Closing connection #0

So my question is; how do I post using curl and print out the response content body?

like image 938
LaserJesus Avatar asked Sep 06 '25 03:09

LaserJesus


1 Answers

It finally worked for me with this command:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do
like image 57
Luis Avatar answered Sep 07 '25 21:09

Luis