当我尝试添加图像 Web 服务 prestashop 时出错
Error when I try to add an image web service prestashop
我正在尝试使用 Web 服务向产品添加图像,但每次尝试时都会出现错误。在我搜索过的几乎所有页面中,这是他们给我的代码:
$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>";
但它总是给我以下内容 error。
翻译错误:
192.168.1.124 页面打不开。
页面 192.168.1.124 现在无法处理此请求。
如有任何帮助,我们将不胜感激。
您好!
我解决了这个问题。我将文件命名为 'Añadir Imagen',localhost 似乎无法识别“ñ”字符。
希望对遇到同样问题的人有所帮助。
您好!
我正在尝试使用 Web 服务向产品添加图像,但每次尝试时都会出现错误。在我搜索过的几乎所有页面中,这是他们给我的代码:
$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>";
但它总是给我以下内容 error。
翻译错误:
192.168.1.124 页面打不开。
页面 192.168.1.124 现在无法处理此请求。
如有任何帮助,我们将不胜感激。 您好!
我解决了这个问题。我将文件命名为 'Añadir Imagen',localhost 似乎无法识别“ñ”字符。
希望对遇到同样问题的人有所帮助。
您好!