Bandai Posted July 4, 2012 Share Posted July 4, 2012 I'm getting this weird error when I try to send a certain string via POST to a PHP script hosted online. This is the string I'm trying to send: <b>character name cd</b>[/Code] The string here that is causing the problem is the two letter "CD". Even if I sent it like this I'm still getting the "Not Acceptable" error. [Code]<b>CD</b> [/Code] or even this: [Code]CD/[/Code] But if I send it like this (any character after CD except space) it goes thru: [Code]<b>CDa</b>[/Code] What could be causing this error? My google-fu wasn't enough for this. I'm testing this via simple HTML form and posting it to the PHP file that would output the value, here's the HTML code for the form: [Code]<form action="http://linkhere.com/accept.php" method="POST" name="acceptme" enctype="multipart/form-data" accept-charset="UTF-8" > <p>Test:</p> <textarea id="testvalue" name="testvalue" rows="10" cols="50"></textarea><br /> <INPUT type="submit" value="Submit" id="submit1" name="submit1"> </form>[/Code] The PHP is accepting it using [code=php:0]file_get_contents("php://input"); Then just displaying the passed value. Other info that might help find out the main cause of the problem: * Shared hosting * mod_security is disabled * Nothing on the Apache error_log file Quote Link to comment https://forums.phpfreaks.com/topic/265208-weird-phpapache-error-posted-value-that-contains-cd-results-to-an-error/ Share on other sites More sharing options...
Pikachu2000 Posted July 4, 2012 Share Posted July 4, 2012 Without seeing the code for the script that processes the data, there's no real way to tell what's going on. A cut and paste of the entire actual error message would probably also be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/265208-weird-phpapache-error-posted-value-that-contains-cd-results-to-an-error/#findComment-1359158 Share on other sites More sharing options...
Bandai Posted July 4, 2012 Author Share Posted July 4, 2012 Without seeing the code for the script that processes the data, there's no real way to tell what's going on. A cut and paste of the entire actual error message would probably also be helpful. Here's the PHP code I'm using for testing and the error is happening with this as well: <?php $str = file_get_contents("php://input"); echo $str; ?> Nothing special here really, any idea what is causing the problem? Quote Link to comment https://forums.phpfreaks.com/topic/265208-weird-phpapache-error-posted-value-that-contains-cd-results-to-an-error/#findComment-1359164 Share on other sites More sharing options...
kicken Posted July 4, 2012 Share Posted July 4, 2012 Sounds to me like the server is probably running mod_security or similar and has a filter setup to deny any requests containing CD followed by a /. Possibly setup to try and prevent attacks involving sending shell commands. You'll have to talk to the hosting company/server admin about it if that is the case. Quote Link to comment https://forums.phpfreaks.com/topic/265208-weird-phpapache-error-posted-value-that-contains-cd-results-to-an-error/#findComment-1359169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.