Possible Duplicate:
PHP php://input vs $_POST
I'm using the Facebook Real-time updates API to subscribe to changes. The docs state:
Following a successful subscription, Facebook will proceed to call your endpoint every time that there are changes (to the chosen fields or connections). For each update, it will make an HTTP POST request.
The request will have content type of
application/json
and the body will comprise a JSON-encoded string containing one or more changes.
~ https://developers.facebook.com/docs/reference/api/realtime/
I tried over and over to access the POST
ed data use $_POST
, which was always empty. After googling for a while, i found this blog post which contained this magical line: $post_body = file_get_contents('php://input');
.
I've never seen php://input
before.... what is this? what does it do? What is Facebook doing on their side to create what I assume is a file with the JSON string in it? Why would they do this rather than sending it through $_POST
?