Created
August 9, 2015 09:26
-
-
Save bologer/58a1fd59107d69b6080f to your computer and use it in GitHub Desktop.
how to parse data from the status of the server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#https://www.tutorials.de/threads/rcon-in-php-um-eine-funktion-erweitern.393275/ | |
$data = 'hostname: Web4f.de [ Countersrike 1.6 - Fun Server ] | |
version : 48/1.1.2.7/Stdio 5787 secure (10) | |
tcp/ip : 178.254.6.180:27015 | |
map : fy_buzzkill at: 0 x, 0 y, 0 z | |
players : 1 active (16 max) | |
# name userid uniqueid frag time ping loss adr | |
# 1 "GuyPrayer" 2 STEAM_0:0:64036919 0 00:22 61 35 91.66.225.231:27005 | |
# 2 "PrayerGuy" 3 STEAM_0:0:64039616 0 00:44 16 53 91.66.231.225:27005 | |
1 users'; | |
if (preg_match_all("~^\s*\#\s*(\d+)\s*\"(.*)\"\s*(\d+)\s*([0-9A-Z\_\:]+)\s*(\d+)\s*([0-9\:]+)\s*(\d+)\s*(\d+)\s*([0-9\.\:]+)$~im", $data, $matches, PREG_SET_ORDER)) { | |
print "<pre>"; | |
print_r($matches); | |
print "</pre>"; | |
} else { | |
echo 'nichts gefunden'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment