fork download
  1.  
  2. <?php
  3. function speedTest() {
  4. // Use a speed test API endpoint
  5. $url = "http://a...content-available-to-author-only...t.net/speedtest/"; // Placeholder URL
  6.  
  7. // Fetch data
  8. $response = file_get_contents($url);
  9. print_r($response);
  10. if ($response === FALSE) {
  11. die('Error occurred while fetching data.');
  12. }
  13.  
  14. // Parse and display results
  15. $data = json_decode($response, true);
  16. echo "Download Speed: " . $data['download'] . " Mbps\n";
  17. echo "Upload Speed: " . $data['upload'] . " Mbps\n";
  18. echo "Ping: " . $data['ping'] . " ms\n";
  19. }
  20.  
  21. // Call the function
  22. speedTest();
  23. ?>
Success #stdin #stdout #stderr 0.03s 26236KB
stdin
Standard input is empty
stdout
Error occurred while fetching data.
stderr
PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/srj8ev/prog.php on line 8
PHP Warning:  file_get_contents(http://a...content-available-to-author-only...t.net/speedtest/): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/srj8ev/prog.php on line 8