Steam installieren
Anmelden
|
Sprache
简体中文 (Vereinfachtes Chinesisch)
繁體中文 (Traditionelles Chinesisch)
日本語 (Japanisch)
한국어 (Koreanisch)
ไทย (Thai)
Български (Bulgarisch)
Čeština (Tschechisch)
Dansk (Dänisch)
English (Englisch)
Español – España (Spanisch – Spanien)
Español – Latinoamérica (Lateinamerikanisches Spanisch)
Ελληνικά (Griechisch)
Français (Französisch)
Italiano (Italienisch)
Bahasa Indonesia (Indonesisch)
Magyar (Ungarisch)
Nederlands (Niederländisch)
Norsk (Norwegisch)
Polski (Polnisch)
Português – Portugal (Portugiesisch – Portugal)
Português – Brasil (Portugiesisch – Brasilien)
Română (Rumänisch)
Русский (Russisch)
Suomi (Finnisch)
Svenska (Schwedisch)
Türkçe (Türkisch)
Tiếng Việt (Vietnamesisch)
Українська (Ukrainisch)
Ein Übersetzungsproblem melden
// Simple UDP port check
// I will be adding static images as well
// shortybsd
set_error_handler('my_error_handler');
function my_error_handler($errno, $errstr, $errfile, $errline) {}
function checkUDP($host,$port=7777){
$fp = fsockopen("udp://".$host, $port, $errno, $errstr,1.0);
if (!$fp) {
return false;
} else {
fclose($fp);
return true;
}
}
$server1 = '192.168.1.7';
if(checkUDP($server1)){
echo $server1.' ElementArk Online';
}else{
echo $server1.' ElementArk Offline';
}
?>
Change port 7777 to example 27015 (for game query port). When using fsocketopen you need to specify it is UDP. You can add more servers as well as if statements to reflect the new servers.
class portScan {
protected $_vars = array();
public $output;
public function set($name, $value) {
if (!isset($this->_vars[$name])) {
$this->_vars[$name] = $value;
} else {
return false;
}
}
public function run() {
$this->output = '';
foreach ($this->_vars['ports'] as $key => $port) {
foreach ($this->_vars['proticals'] as $key => $protical) {
$port_scan = $this->_scan($protical,$port);
if ($port_scan) {
$this->output .= $this->_vars['server_name'] . " Offline (Protical:{$protical} Port:{$port})<br />";
} else {
$this->output .= $this->_vars['server_name'] . " Online (Protical:{$protical} Port:{$port})<br />";
}
}
}
return $this;
}
private function _scan($protical,$port) {
$fp = fsockopen("{$protical}://" . $this->_vars['host'], $port, $errno, $errstr,1.0);
if (!$fp) {
return false;
} else {
fclose($fp);
return true;
}
}
}
?>
//this code you can use anywere if you include the above file...
<?php
$portscan = new portScan();
$portscan->set("server_name", 'Ark Server'); //server name
$portscan->set("host", '123.123.123.123'); //server ip
$portscan->set("ports", array(80,7777,27015)); //add more ports but it will be slow
$portscan->set("proticals", array('udp')); //add more proticals like tcp or ftp
if ($portscan->run()) { echo $portscan->output; } //html output
?>
Html OutPut will be:
Ark Server Offline (Protical:udp Port:80)
Ark Server Offline (Protical:udp Port:7777)
Ark Server Offline (Protical:udp Port:27015)
just a basic class code to know if a server is online or not ;)
if you needed help just pm me and ask me and maby i can help you ;)
greetz.
and your local copy ..can be checked by parsing the appmanifest file, the .acf one, there is also an entry with buildid