3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<table><tr><th>Monitor Name</th><th>Status</th><th>Total Uptime</th></tr>"; $apiKey = "u133524-954ab29667a46f5ec915858c"; $url = "http://api.uptimerobot.com/getMonitors?apiKey=" . $apiKey . "&format=xml"; $xml = file_get_contents($url); $xml = new SimpleXMLElement ($xml); foreach($xml->monitor as $monitor) { echo "<tr>"; echo "<td>"; echo $monitor['friendlyname']; echo "</td><td>"; if ($monitor['status'] == 2) { echo "Online"; } elseif ($monitor['status'] == 9) { echo "Offline"; } else { echo "Not Available"; } echo "</td><td>"; if ($monitor['alltimeuptimeratio'] > 95) { echo "<b style=\"color:green;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>"; } else { echo "<b style=\"color:red;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>"; } } echo "</table>"; ?>

preferences:
46.67 ms | 402 KiB | 5 Q