fork download
  1. <?php
  2. $url = "http://115.245.30.253:10099"; // API URL
  3.  
  4. // Initialize cURL session
  5. $ch = curl_init();
  6. curl_setopt($ch, CURLOPT_URL, $url);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable SSL verification if needed
  9.  
  10. // Execute cURL request
  11. $json = curl_exec($ch);
  12.  
  13. // Check for cURL errors
  14. if ($json === false) {
  15. die("cURL Error: " . curl_error($ch));
  16. }
  17.  
  18. // Close cURL session
  19.  
  20. // Decode JSON response
  21. $data = json_decode($json, true);
  22.  
  23. // Check for JSON decode errors
  24. if ($data === null) {
  25. die("JSON Decode Error: " . json_last_error_msg());
  26. }
  27.  
  28. // Display raw JSON response
  29. echo "<h3>Raw JSON Response:</h3>";
  30. echo "<pre>" . htmlspecialchars($json) . "</pre>";
  31.  
  32. // Display structured data
  33. echo "<h3>Formatted Response:</h3>";
  34. echo "<pre>";
  35. print_r($data);
  36. echo "</pre>";
  37.  
  38. // // Debug keys
  39. // echo "<h3>Available Keys:</h3>";
  40. // echo "<pre>";
  41. // print_r(array_keys($data));
  42. // echo "</pre>";
  43.  
  44. // // Example: Access specific data (Modify based on API response)
  45. // if (isset($data["DKK"]["15m"])) {
  46. // echo "<p>DKK 15m Value: " . $data["DKK"]["15m"] . "</p>";
  47. // }
  48.  
  49. // if (isset($data["BRL"])) {
  50. // echo "<p>BRL Value: " . $data["BRL"] . "</p>";
  51. // } else {
  52. // echo "<p>Key 'BRL' not found in the response.</p>";
  53. // }
  54. ?>
Success #stdin #stdout 0.04s 25872KB
stdin
Standard input is empty
stdout
cURL Error: