jgianfreda Posted November 30, 2012 Share Posted November 30, 2012 (edited) Hello, i'm new with prestashop and I'm using version 1.5.2.0. I already read the CRUD tutorial from prestashop and did everything by myself. I'm now facing a problem and I didn't find the solution on this forum. I'm trying to modify a product's picture to replace it by an other one, and, why not, setting the new picture as the shown picture on the products page. Here is my code to add an image (it works) <html><head><title>Upload Image</title></head><body> <?php define('PS_SHOP_PATH', 'http://monsite/prestashop1520/api/images/products/1'); define('PS_WS_AUTH_KEY', 'MaCleWebServices:'); $img=$_SERVER["DOCUMENT_ROOT"].'prestashop1520/test.png'; $data = array('image'=>"@".$img.";type=image/png"); // envoie de l'image via CURL $curl = curl_init(); curl_setopt($curl,CURLOPT_HEADER, true); curl_setopt($curl,CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLINFO_HEADER_OUT, true); curl_setopt($curl, CURLOPT_URL, PS_SHOP_PATH); curl_setopt($curl, CURLOPT_POST, true); //curl_setopt($curl, CURLOPT_PUT, true); curl_setopt($curl, CURLOPT_HTTPAUTH, 'CURLAUTH_BASIC'); curl_setopt($curl, CURLOPT_USERPWD, PS_WS_AUTH_KEY); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_exec($curl); curl_close($curl); ?> </body></html> Have you got any idea of what can I do to solve my problems? Best reguards, Jonathan. Edited November 30, 2012 by jgianfreda (see edit history) Link to comment Share on other sites More sharing options...
Intra Posted January 31, 2013 Share Posted January 31, 2013 Download samples files at : http://doc.prestashop.com/display/PS14/Using+the+REST+webservice Link to comment Share on other sites More sharing options...
Recommended Posts