Salut,
C'est peut être con, mais je bloque.
Je dois utiliser CURL pour faire un put.
Le souci est que je n'arrive pas à faire passer une variable dans CURLOPT_POSTFIELDS.
Dès que j’exécute le script, j'ai des soucis comme que voici:
<html><head><title>404 Page Not Found</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>404 Page Not Found</h1><p>The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.</p><a href="/rest/v3/">Visit the Home Page</a></body></html>root@Mobilite:/GET#
On dirait que le header ou je ne sais pas quoi, empêche de bien fermer la requête curl.
Voici mon script:
$listId="https://www.xxxx.com/rest/v3/lists/125716";// N° de la liste
$POST="POST";
$HTTP="CURLOPT_HTTP_VERSION";
$HEADER = array();
$HEADER[] = "Authorization:".$token;
$HEADER[] = "cache-control: no-cache";
$HEADER[] = "content-type: application/json";
// Initialisation de la requête
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $listId);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HTTP_VERSION, $HTTP);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $POST);
curl_setopt($curl, CURLOPT_POSTFIELDS, $BDDTIERS);
curl_setopt($curl, CURLOPT_HTTPHEADER, $HEADER);
// Envoi de la requête et affichage de la réponse
$response = curl_exec($curl);
$err = curl_error($curl);
Vous avez une idée?
Merci