Advertisement
Guest User

Check Online Status of GW2-Servers

a guest
May 18th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <?php
  2.  
  3.     define('FORCE_FSOCK',   true);      // False = use ping/ICPM for Port 80, True = always use FSOCK
  4.  
  5.     $servers    = array('Diag.ArenaNetworks.com'        => array(   '34.235.245.105:80',
  6.                                             '34.236.133.94:80',
  7.                                             '34.237.20.65:6112',
  8.                                             '34.237.20.65:80',
  9.                                             '34.236.133.94:6112',
  10.                                             '34.194.154.37:80',
  11.                                             '34.235.245.105:6112',
  12.                                             '34.194.154.37:6112',
  13.                                             '34.225.225.173:6112',
  14.                                             '34.225.225.173:80' ),
  15.                 'assetcdn.101.ArenaNetworks.com'    => array(   '13.35.253.92:80',
  16.                                             '13.35.253.148:80',
  17.                                             '13.35.253.177:80',
  18.                                             '13.35.253.214:80'  ),
  19.                 'auth1.101.ArenaNetworks.com'       => array(   '34.237.20.65:6112',
  20.                                             '34.236.133.94:6112',
  21.                                             '34.194.154.37:6112',
  22.                                             '34.235.245.105:6112',
  23.                                             '34.225.225.173:6112'   ),
  24.  
  25.                 'auth2.101.ArenaNetworks.com'       => array(   '35.158.82.209:6112',
  26.                                             '35.157.208.241:6112',
  27.                                             '18.194.203.41:6112',
  28.                                             '35.158.175.20:6112',
  29.                                             '52.59.151.62:6112' ),
  30.                 'cligate.101.NCPlatform.net'        => array(   '18.184.132.250:6112',
  31.                                             '18.194.9.177:6112',
  32.                                             '35.157.77.102:6112',
  33.                                             '3.121.82.222:6112',
  34.                                             '18.184.118.144:6112',
  35.                                             '18.185.197.21:6112',
  36.                                             '18.197.66.19:6112' )   );
  37.  
  38.     foreach ($servers as $group=>$ips) {
  39.        
  40.         echo "\n".'Checking ('.$group.')'."\n\n";
  41.        
  42.         foreach ($ips as $ip) {
  43.            
  44.             $atoms  = explode(':', $ip);
  45.            
  46.             if (count($atoms) == 2) {
  47.                 $ip = $atoms[0];
  48.                 $port   = $atoms[1];
  49.             } else {
  50.                 $ip = $atoms[0];
  51.                 $port   = 80;
  52.             }
  53.            
  54.             echo "\t".'Testing ('.$ip.') ';
  55.            
  56.             if ((FORCE_FSOCK) || ($port <> 80)) {
  57.                
  58.                 if (!$socket = @fsockopen($ip, $port, $errno, $errstr, 30)) {
  59.                     echo '-=> offline [#'.$errno.': '.$errstr."]\n";
  60.                 } else {
  61.                     echo "-=> online\n";
  62.                     fclose($socket);
  63.                 }
  64.        
  65.             } else {
  66.                
  67.                 $str    = exec("ping -n 1 -w 1 ".$ip, $input, $result);
  68.  
  69.                 if ((int)$result == 0) {
  70.                     echo "-=> Online!\n";
  71.                 } else {
  72.                     echo "-=> Offline!\n";
  73.                 }
  74.            
  75.             }          
  76.            
  77.         }
  78.        
  79.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement