Hi! I'm trying to add/upload product images via Prestashop API, but I'm getting server error 500. What can be wrong with the code? Or maybe there's something wrong with the server configuration?
Prestashop version: 1.7.6.4
PHP script:
error_reporting(-1); ini_set('display_errors', 'On'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://[email protected]//api/images/products/24/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_USERPWD, 'MY_AUTH_KEY:'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' =>'@http://my-shop.com/img/my-shop-logo-1584646645.jpg;type=image/jpg')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); $curlinfo = curl_getinfo($ch); curl_close($ch); print_r($curlinfo);
This results in [http_code] => 500. There's no error or anything. I have access to the hosting provider's server error log, but there's nothing in there...
I've enabled debug mode in the back office, but it doesn't seem to affect the API. Is there any other way to debug it?
The script is based on the Prestashop docs: https://devdocs.prestashop.com/1.7/development/webservice/tutorials/change_product_image/