sooi65 Posted September 30, 2014 Share Posted September 30, 2014 (edited) Hello, We experienced problems using the PUT method on one of our customers' servers while trying to update category data with the PrestShop REST api.Although all credentials where correctly setup we got the message'403 Forbidden - You dont have the permission blablabla'On our development server we did not have this issue. After spending some time trying to find the location where it went wrong we ended up in the dispatcher.php file. The problem ocurred int these lines // if a XML is in PUT or in POSTif (($_SERVER['REQUEST_METHOD'] == 'PUT') || ($_SERVER['REQUEST_METHOD'] == 'POST')){ while ($putData = fread($putresource, 1024)) // <== The while loop failed $input_xml .= $putData; fclose($putresource);} Changing these lines into the ones as shown below solved the problem. // if a XML is in PUT or in POSTif (($_SERVER['REQUEST_METHOD'] == 'PUT') || ($_SERVER['REQUEST_METHOD'] == 'POST')){ while (!feof($putresource )) { $input_xml .= fread($putresource, 1024); } fclose($putresource);} Having a chat with the hosting provider learned that it probably has something to do with the combination of Apache and PHP using FastCGI and maybe the PHP version (5.4) Hope this info is useful for others.Kind regards, Frans Edited September 30, 2014 by sooi65 (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now