fork download
  1. <?php
  2. // Initialize cURL session
  3. $curl = curl_init();
  4.  
  5. // Set cURL options
  6. curl_setopt($curl, CURLOPT_URL, 'https://g...content-available-to-author-only...b.com/json/geoip.php');
  7. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  8.  
  9. // Execute cURL session
  10. $response = curl_exec($curl);
  11.  
  12. // Check for errors
  13. if ($response === false) {
  14. $error = curl_error($curl);
  15. echo 'cURL Error: ' . $error;
  16. } else {
  17. // Decode JSON response
  18. $data = json_decode($response, true);
  19.  
  20. // Print the response
  21. print_r($data);
  22. }
  23.  
  24. // Close cURL session
  25. curl_close($curl);
  26.  
  27. ?>
  28.  
Success #stdin #stdout 0.03s 25932KB
stdin
Standard input is empty
stdout
cURL Error: Could not resolve host: geolocation-db.com