$_POST is empty
I'm posting data from a Flex app to a php script. GET works fine but POST doesn't seem to transmit anything. as3httpclintlib is the library I'm working with, however, I kind of doubt that is the problem, because replicating the request in php gives me the same result. I've looked around and while there seem to be multiple issues similar to this, none of the proposed suggestions worked.
My php.ini looks good from what I can tell, however I did recently recompile Apache and PHP.
//php.ini
...
variables_order = "EGPCS"
register_globals = off
register_argc_argv = On
post_max_size = 8M
gpc_order = "GPC"
...
the request body is pretty simple:
data={\"id\":0,\"password\":\"abcdefg\",\"name\":\"testUser\",\"createdOn\":null,\"apikey\":\"hijklmn\"}
it looks weird w/ all the slashes, but I stripslashes() and it works fine... usually.
So, it's not Flash, because a request from PHP acts the same way. It's not the request -- seemingly -- because an identical GET works fine, Content-Type is set to 'application/x-www-form-urlencoded'. I'm pretty sure it has something to do with the recent compilation but that's about as far as I have been able to take it. Thank you for any suggestions.
Apache 2.2 PHP 5.3.3
UPDATE: Still haven't gotten it working, but it looks like it might be apart of my Apache configuration. I didn't think anything I did was substandard, but I am not seeing many other solutions. Is there anything in particular I should look for to check against my config?
UPDATE 2: After recompiling Apache and PHP with only the required modules and extensions it worked fine. I had some extra stuf开发者_Go百科f loaded for future use, perhaps.... perhaps it was one of those that was throwing things off.
I had the same problem with PHP 5.3.2 Suhosin-Patch and a htaccess file overriding:
php_value post_max_size = 150M
Here is a one line workaround :
parse_str(file_get_contents('php://input'), $_POST);
First, your request body parameters should be URL encoded (maybe it is but you decoded it for readability?). Secondly, check the magic_quotes_gpc setting in php.ini, it may make a difference.
Lastly, you can check if the POST actually works by reading the raw POST data:
echo file_get_contents('php://input');
If all else fail, try this in your .htaccess
file:
<IfModule mod_security.c>
SecFilterScanPOST Off
</IfModule>
If this is the problem, either fix Mod Security of your Apache, or disable it for that script.
精彩评论