Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('STAT_SERVER_IP' , '64.22.107.125');
- define('STAT_SERVER_HOST', 'dpmaster.deathmask.net');
- define('STAT_SERVER_PATH', '?game=warsow&server={IP}:{Port}&xml=1');
- function reqServers($Servers) {
- $curly = array();
- $result = array();
- $mh = curl_multi_init();
- foreach ($Servers as $id => $s) {
- $curly[$id] = curl_init();
- curl_setopt($curly[$id], CURLOPT_URL, str_replace(
- array('{IP}', '{Port}'),
- array($s->IP, $s->Port),
- 'http://'.STAT_SERVER_IP.'/'.STAT_SERVER_PATH)
- );
- curl_setopt($curly[$id], CURLOPT_HEADER, 0);
- curl_setopt($curly[$id], CURLOPT_HTTPHEADER, array('Host: '.STAT_SERVER_HOST));
- curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, 1);
- curl_multi_add_handle($mh, $curly[$id]);
- }
- $running = null;
- do {
- curl_multi_exec($mh, $running);
- } while($running > 0);
- foreach($curly as $id => $c) {
- $result[$id] = curl_multi_getcontent($c);
- curl_multi_remove_handle($mh, $c);
- }
- curl_multi_close($mh);
- return $result;
- }
- class Server {
- public $IP, $Port;
- public function __construct($IP, $Port)
- {
- $this->IP = $IP;
- $this->Port = $Port;
- }
- }
- $r = reqServers(array(
- new Server('178.63.89.77', 44410),
- new Server('178.63.89.77', 44420),
- new Server('93.170.105.188', 44410),
- new Server('93.170.105.188', 44420),
- new Server('178.63.89.77', 44410),
- new Server('178.63.89.77', 44420),
- new Server('93.170.105.188', 44410),
- new Server('93.170.105.188', 44420),
- new Server('198.199.125.100', 44400),
- new Server('178.63.69.69', 44401),
- new Server('198.211.116.185', 44410),
- new Server('198.211.116.185', 44420),
- new Server('198.199.125.100', 44400),
- new Server('178.63.69.69', 44401),
- new Server('198.211.116.185', 44410),
- new Server('198.211.116.185', 44420),
- new Server('84.200.14.116', 44410),
- new Server('178.63.89.77', 44430),
- new Server('84.200.14.116', 44410),
- new Server('178.63.89.77', 44430)
- ));
- echo '<pre>';
- print_r($r);
- echo '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement