Firstly install httpie
sudo apt-get install httpie
Next in firs console run server
php -S 0.0.0.0:8000
In second consoel run sender
bash sender.sh
You should see:
Processing file1.json
POST /app.php HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 14
Content-Type: application/json
Host: 127.0.0.1:8000
User-Agent: HTTPie/0.9.2
{
"a": "b"
}
HTTP/1.1 200 OK
Connection: close
Content-type: text/html; charset=UTF-8
Host: 127.0.0.1:8000
X-Powered-By: PHP/7.0.15-0ubuntu0.16.04.4
{
"a": "b"
}
Processing file2.json
POST /app.php HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 13
Content-Type: application/json
Host: 127.0.0.1:8000
User-Agent: HTTPie/0.9.2
{
"d": "e"
}
HTTP/1.1 200 OK
Connection: close
Content-type: text/html; charset=UTF-8
Host: 127.0.0.1:8000
X-Powered-By: PHP/7.0.15-0ubuntu0.16.04.4
{
"d":"e"
}
There are two requests and two responses.