There is a need to monitor the server kc.

Are there any libraries in which this is implemented fairly simple?

Closed due to the fact that the essence of the question is incomprehensible by the participants Vladimir Martyanov , user194374, Yuri Negometyanov , insolor , aleksandr barakin 5 Mar '16 at 15:26 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Buy a script ... - AseN
  • four
    Would you like to say that you did not find anything for the query "script monitoring server cs php"? - teanYCH

1 answer 1

Here is the simplest example of CS 1.6 monitoring, which displays:

Server: 46.38.56.3:27015

Name: Army Ranks 1.3

Map: cs_assault

Players: 19/24

Status: On-line

<?php $server = '46.38.56.3'; $port = '27015'; function GetServerInfo($server,$port) { $fp = @fsockopen("udp://".$server, $port); if (!$fp) return false; @fwrite($fp,"\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00".chr(10)); $start=time(); socket_set_timeout($fp,1); $st=fread($fp,1); $r=socket_get_status($fp); $result['status'] = $r["timed_out"]; $r=$r["unread_bytes"]; if ($r == 0) { @fclose($fp); return false;} $st.=fread($fp,$r); @fclose($fp); $st=substr($st,5); $address=SubStr($st,0,StrPos($st,chr(0))); $address=str_replace(chr(0),"|",$address); $st=SubStr($st,StrPos($st,chr(0))+1); $name=SubStr($st,0,StrPos($st,chr(0))); $st=SubStr($st,StrPos($st,chr(0))+1); $map=SubStr($st,0,StrPos($st,chr(0))); $st=SubStr($st,StrPos($st,chr(0))+1); $st=SubStr($st,StrPos($st,chr(0))+1); $st=SubStr($st,StrPos($st,chr(0))+1); $current=ord(SubStr($st,0,1)); $max=ord(SubStr($st,1,1)); if ($map == "") return false; $result['map'] = $map; $result['name']= $name; $result['current'] = $current; $result['max'] = $max; return $result; } $serv = GetServerInfo($server,$port); if ($serv) { echo ' Сервер: '.$server.':'.$port.' <br> Название: '.$serv['name'].' <br> Карта: '.$serv['map'].' <br> Игроков: '.$serv['current'].'/'.$serv['max'].' <br> Статус: On-line '; } else { echo 'Статус: Off-line'; } ?>