Converting curl command to netcat?
I am trying to convert curl (post) command to 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 don't know how to POST something
For example: I want to store the 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?
+3
source to share
1 answer
nc localhost 1234
POST /123 HTTP/1.0
Content-Length: 8
Content-Type: application/x-www-form-urlencoded
\n
val=2300
Content-Length
configured so that the server knows how much data you are going to send (string length "val = 2300"). Content-Type
means that the server knows what format the data is in (encoded in the form). \n
is the HTTP separator character (empty string) between headers and data.
+2
source to share