Advertisement
Brandan

Untitled

Jul 16th, 2012
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. // file example 1: read a text file into an array, with
  3. // each line in a new element
  4. try {
  5.   $filename="http://xwis.brandanlasley.com:200/serverinfo.txt";
  6.   $serverinfo = array();
  7.   $file = fopen($filename, "r");
  8.   while(!feof($file)) {
  9.   //read file line by line into a new array element
  10.   $serverinfo[] = fgets($file, 4096);
  11.   }
  12.   fclose ($file);
  13.   print_r($serverinfo);
  14.   $serverinfo = file_get_contents("http://xwis.brandanlasley.com:200/serverinfo.txt");
  15.   echo "Debug: $serverinfo";
  16.   echo "<br>";
  17.   echo "Server Name: $serverinfo[0]";
  18.   echo "<br>";
  19.   echo "Current Map: $serverinfo[1]";
  20.   echo "<br>";
  21.   echo "Players Ingame: $serverinfo[2]";
  22. } catch (Exception $e) {
  23.   echo 'Error Fetching Information: ',  $e->getMessage(), "\n";
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement