I am trying to convert a curl command (post) to a netcat command.
I already figured out how to GET/DELETE things like
curl -v http://localhost:1234/232
in netcat:
nc localhost 1234
GET 232
HOST: localhost
but I dont know how to POST something
For example: I want to save to value 2300 in my path 123
curl -v --data "val=2300" http://localhost:1234/123
and in netcat:
nc localhost 1234
POST 123
HOST: localhost
but where do i write my value?
nc localhost 1234
POST /123 HTTP/1.0
Content-Length: 8
Content-Type: application/x-www-form-urlencoded
\n
val=2300
Content-Length
is set to let the server know how much data you're going to send (string length of "val=2300"). Content-Type
is to let the server know in which format the data is (form-encoded). The \n
is the HTTP separation character (empty line) between headers and data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With