corlinea Posted February 25, 2015 Share Posted February 25, 2015 Bonjour à tous, J'utilise le webservice sur un site et je rencontre un problème. J'utilise Curl pour envoyer des images a des produits de ma boutique, les ajouts d'image fonctionne très bien par contre lorsqu'il s'agit de modifier l'image ça plante et j'ai une erreur 411 "PUT requires a valid Content-length". J'ai repris exactement le code fourni dans la documentation Prestashop. Je vous remercie pour vos retours Cordialement. $image_path = ROOT_PATH.'uploads/medias/annonces/sources/'.$annonce->image; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, PS_SHOP_PATH.'/api/images/products/'.$id_product_inserted); if($save == 'edit'){ curl_setopt($ch, CURLOPT_PUT, true); // Un-commet to edit an image }else{ curl_setopt($ch, CURLOPT_POST, true); } curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY.':'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); Link to comment Share on other sites More sharing options...
corlinea Posted March 2, 2015 Author Share Posted March 2, 2015 Personne n'a de réponse pour ce bug ? 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