Reputation: 2485
If I post data to a test script on my web server (from a remote source) the $_POST array is empty but HTTP_RAW_POST_DATA has the posted information.
Data posted locally with a form works fine.
The server is Ubuntu 12.04/Apache/PHP 5.3.10, its a standard build.
UPDATE
Im using this to test the endpoint https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo/
This is the REST server I am implementing https://github.com/philsturgeon/codeigniter-restserver. Its been installed on a standard LAMP stack, and a fresh codeigniter install.
There are no redirects happening.
Upvotes: 1
Views: 802
Reputation: 2821
1. $_POST contains URL encoded (application/www-url-encoded) variables that are posted to your script and PHP decodes them for you. You use this one when you deal with HTML FORM data.
2. $HTTP_RAW_POST_DATA - gets the raw POST data and you need to use this when you write APIs and need XML/JSON/... input that cannot be decoded to $_POST by PHP.
Upvotes: 1
Reputation: 3974
Are you sure you're not getting some kind of redirection? For example, you send post data to http://somedomain.com and it auto redirects you to https://somedomain.com or http://www.somedomain.com... You will lose your post data that way.
Upvotes: 2