source: branches/old/projectonlineplayes/source/PHP - load info about server/xml.php

Last change on this file was 195, checked in by maron, 17 years ago

Oprava projektu online hráči

File size: 2.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="PSPad editor, www.pspad.com">
6 <title></title>
7 </head>
8 <body>
9
10<?php
11
12 function GetServerInfo($URL)
13 { // BEGIN function GetServerInfo
14 $xml = new XMLReader();
15 // $xml->setParserProperty(2,true); // This seems a little unclear to me - but it worked :)
16 $xml->Open($URL);
17
18 while ($xml->read()) {
19 switch ($xml->name) {
20 case "servername":
21 $xml->read();
22 $info['sarvername'] = $xml->value;
23 $xml->read();
24 break;
25 case "owner":
26 $xml->read();
27 $info['owner'] = $xml->value;
28 $xml->read();
29 break;
30 case "patch":
31 $xml->read();
32 $info['patch'] = $xml->value;
33 $xml->read();
34 break;
35 case "registration":
36 $xml->read();
37 $info['registration'] = $xml->value;
38 $xml->read();
39 break;
40 case "maxplayers":
41 $xml->read();
42 $info['maxplayers'] = $xml->value;
43 $xml->read();
44 break;
45 case "xp":
46 $xml->read();
47 $info['xp'] = $xml->value;
48 $xml->read();
49 break;
50 case "playerscount":
51 $xml->read();
52 $info['playerscount'] = $xml->value;
53 $xml->read();
54 break;
55 }
56 }
57 return $info;
58 } // END function GetServerInfo
59
60 $info = GetServerInfo('http://wow.zdechov.net/projectonlineplayes/create_xml.php');
61
62 echo '<table>';
63 echo '<tr><td>ServerName:</td> <td><b>'.$info['sarvername'].'</b></td></tr>';
64 echo '<tr><td>Vlastník serveru:</td> <td><b>'.$info['owner'].'</b></td></tr>';
65 echo '<tr><td>Patch serveru:</td> <td><b>'.$info['patch'].'</b></td></tr>';
66 echo '<tr><td>Registrace: </td><td><b>'.$info['registration'].'</b></td></tr>';
67 echo '<tr><td>Maximální počet hráčů:</td> <td><b>'.$info['maxplayers'].'</b></td></tr>';
68 echo '<tr><td>XP Rate:</td> <td><b>'.$info['xp'].'</b></td></tr>';
69 echo '<tr><td>Počet hráčů:</td> <td><b>'.$info['playerscount'].'</b></td></tr>';
70 echo '</table>';
71
72
73?>
74 </body>
75</html>
Note: See TracBrowser for help on using the repository browser.