Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // file example 1: read a text file into an array, with
- // each line in a new element
- try {
- $filename="http://xwis.brandanlasley.com:200/serverinfo.txt";
- $serverinfo = array();
- $file = fopen($filename, "r");
- while(!feof($file)) {
- //read file line by line into a new array element
- $serverinfo[] = fgets($file, 4096);
- }
- fclose ($file);
- print_r($serverinfo);
- $serverinfo = file_get_contents("http://xwis.brandanlasley.com:200/serverinfo.txt");
- echo "Debug: $serverinfo";
- echo "<br>";
- echo "Server Name: $serverinfo[0]";
- echo "<br>";
- echo "Current Map: $serverinfo[1]";
- echo "<br>";
- echo "Players Ingame: $serverinfo[2]";
- } catch (Exception $e) {
- echo 'Error Fetching Information: ', $e->getMessage(), "\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement