Bash POST chunked data using nc (netcat)

Create temporary server to display POST data.

// server.php

Run server.

$ php -S server.php

POST to server using the nc command.

$ echo -ne "POST / HTTP/1.0\r\nContent-Type: application/x-www-form-urlencoded\r\nTransfer-Encoding: chunked\r\n\r\n4\r\nfoo=\r\n3\r\nbar\r\n0\r\n\r\n" | nc 8000
HTTP/1.0 200 OK
Connection: close
Content-type: text/html; charset=UTF-8
array(1) {
  string(3) "bar"
This post is available on GitHub.
Posted .


Leave a Reply