fork download
  1. <?php
  2. // Configuration
  3. $agency_id = "24128";
  4. $provider = "4134";
  5. $token = "de8cb83ed042bba9fbc90d3dc8a265013340811b";
  6. $api_url = "https://a...content-available-to-author-only...o.pro/agencies/$agency_id/properties";
  7.  
  8. // Initialisation de la requête cURL
  9. $ch = curl_init();
  10.  
  11. // Configuration des options cURL
  12. curl_setopt($ch, CURLOPT_URL, $api_url);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  15. curl_setopt($ch, CURLOPT_USERPWD, "$provider:$token");
  16.  
  17. // Exécution de la requête
  18. $response = curl_exec($ch);
  19.  
  20. // Gestion des erreurs
  21. if (curl_errno($ch)) {
  22. http_response_code(500);
  23. echo json_encode([
  24. "error" => "Erreur lors de la requête API : " . curl_error($ch)
  25. ]);
  26. curl_close($ch);
  27. }
  28.  
  29. // Fermeture de la session cURL
  30.  
  31. // Envoi de la réponse au front-end
  32. header('Content-Type: application/json');
  33. echo $response;
  34. ?>
Success #stdin #stdout 0.04s 26608KB
stdin
Standard input is empty
stdout
{"error":"Erreur lors de la requ\u00eate API : Could not resolve host: api.apimo.pro"}