I'm trying to add an image to a product using web services, but everytime I try, I get an error. In almost all the pages I have searched this is the code they gave me:
$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; //WebService Key
$url = 'https://192.168.1.124/prestashop/api/images/products/2';
$imagen = 'C:\\camisa.png';
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_POST,true);
//curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image
curl_setopt($curl,CURLOPT_USERPWD,$key.':');
curl_setopt($curl,CURLOPT_POSTFIELDS,array('image' => '@'.$imagen.';type=image/png'));
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($curl);
curl_close($curl);
echo "<h3>Imagen añadida</h3>";
But it always gives me the following error.
Error Translation:
The page 192.168.1.124 doesn't work.
The page 192.168.1.124 can't process this request right now.
Any help will be appreciated. Greetings!
I solved the problem. I named the file 'Añadir Imagen' and it seems that localhost doesn't recognize the 'ñ' character.
Hope that it helps someone with the same problem.
Greetings!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments