3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $SERVER_IP = "185.38.148.147"; //Insert the IP of the server you want to query. $SERVER_PORT = "25581"; //Insert the PORT of the server you want to ping. Needed to get the favicon, motd, players online and players max. etc $QUERY_PORT = "28016"; //Port of query.port="" in your server.properties. Needed for the playerlist! Can be the same like the port or different. Query must be enabled in your server.properties file! $HEADS = "3D"; //"normal" / "3D" $show_max = "unlimited"; // how much playerheads should we display? "unlimited" / "10" / "53"/ ... $SHOW_FAVICON = "on"; //"off" / "on" $ping = json_decode(file_get_contents('http://api.minetools.eu/ping/' . $SERVER_IP . '/' . $SERVER_PORT . ''), true); $query = json_decode(file_get_contents('http://api.minetools.eu/query/' . $SERVER_IP . '/' . $QUERY_PORT . ''), true); if(empty($ping['error'])) { $version = $ping['version']['name']; $online = $ping['players']['online']; $max = $ping['players']['max']; $motd = $ping['description']; $favicon = $ping['favicon']; } if(empty($query['error'])) { $playerlist = $query['Playerlist']; } ?>
Output for 5.3.18 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/sMLUe on line 10 Warning: file_get_contents(http://api.minetools.eu/ping/185.38.148.147/25581): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/sMLUe on line 10 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/sMLUe on line 11 Warning: file_get_contents(http://api.minetools.eu/query/185.38.148.147/28016): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/sMLUe on line 11
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/sMLUe on line 10 Warning: file_get_contents(http://api.minetools.eu/ping/185.38.148.147/25581): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/sMLUe on line 10 Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/sMLUe on line 11 Warning: file_get_contents(http://api.minetools.eu/query/185.38.148.147/28016): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/sMLUe on line 11