Php – parse POST request from HTTP Request body

php

What is the best and easiest way to get the HTTP Body from the POST request and parse it with variables? Say I have two attributes called latitude and longitude in the body in which the values I want to extract.

Another thing is how can I test it so I can see these values?

Best Solution

In your PHP which handles the POST request you can do something like:

$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];

Some browsers have developer tools that allow you to see the POST data that the browser sent. I use the FireBug plug-in for Firefox. I think the built-in developer tools in IE 8 and above (F12 I think) can do the same thing. Not sure about Chrome, but I'm sure there's something around.