fork download
  1. <?php
  2. $site_id = "6496499eaace6d8ddfdee536";
  3. $api_token = "169b23b552d7723bc6dc876cde7fcea83d459434c60dd3bd3fafd3099a5da99c";
  4.  
  5. $url = "https://a...content-available-to-author-only...w.com/v2/sites/6496499eaace6d8ddfdee536";
  6.  
  7. $headers = array(
  8. "Authorization: Bearer $api_token",
  9. "Content-Type: application/json"
  10. );
  11.  
  12. $ch = curl_init($url);
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  15.  
  16. $response = curl_exec($ch);
  17.  
  18. if (curl_errno($ch)) {
  19. echo 'cURL error: ' . curl_error($ch);
  20. curl_close($ch);
  21. }
  22.  
  23. $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  24.  
  25. if ($status_code == 200) {
  26. $site_data = json_decode($response, true);
  27. echo "Site Name: " . $site_data['name'] . "\n";
  28. echo "Timezone: " . $site_data['timezone'] . "\n";
  29. } else {
  30. echo "Failed to retrieve site data. Status code: $status_code\n";
  31. echo "Response: $response\n";
  32. }
  33. ?>
  34.  
Success #stdin #stdout 0.03s 25908KB
stdin
Standard input is empty
stdout
cURL error: Could not resolve host: api.webflow.com