Authentification avec l'API suivie de la poste (okapi)
Bonjour, quelqu'un pourrais t'il me dire le problème avec ce code ?
j'obtiens une erreur http 401 j'ai essayé plein de choses je bloque.
le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| $postdata = http_build_query(
array(
'id' => 'numéro de suivie',
'lang' => 'fr_FR'
)
);
$opts = array('http' =>
array(
'method' => 'GET',
'header' => 'Content-type: application/json;\r\nAccept: application/json\r\ncharset=utf-8\r\nX-Okapi-Key:clef d authentification' ,
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('https://api.laposte.fr/suivi/v2/idships/numéro de suivie?lang=fr_FR',false,$context);
echo $result; |
docu : https://developer.laposte.fr/product...tion#heading-2
merci de votre aide