function connect() { global $dump1090_ip, $sockets, $stdout; $s = create_socket($dump1090_ip, "30002", $errno, $errstr); if ($s) { if ($stdout) { echo 'Connection in progress to Dump1090....' . "\n"; } } else { if ($stdout) { echo 'Connection failed to Dump1090 : ' . $errno . ' ' . $errstr . "\n"; } } return $s; }
function connect_all($hosts) { global $sockets, $formats, $globalDebug, $aprs_connect, $last_exec; foreach ($hosts as $id => $host) { // Here we check type of source(s) if (filter_var($host, FILTER_VALIDATE_URL)) { if (preg_match('/deltadb.txt$/i', $host)) { $formats[$id] = 'deltadbtxt'; $last_exec['deltadbtxt'] = 0; if ($globalDebug) { echo "Connect to deltadb source...\n"; } } else { if (preg_match('/aircraftlist.json$/i', $host)) { $formats[$id] = 'aircraftlistjson'; $last_exec['aircraftlistjson'] = 0; if ($globalDebug) { echo "Connect to aircraftlist.json source...\n"; } } else { if (preg_match('/planeUpdateFAA.php$/i', $host)) { $formats[$id] = 'planeupdatefaa'; $last_exec['planeupdatefaa'] = 0; if ($globalDebug) { echo "Connect to planeUpdateFAA.php source...\n"; } } else { if (preg_match('/\\/action.php\\/acars\\/data$/i', $host)) { $formats[$id] = 'phpvmacars'; $last_exec['phpvmacars'] = 0; if ($globalDebug) { echo "Connect to phpvmacars source...\n"; } } else { if (preg_match('/whazzup/i', $host)) { $formats[$id] = 'whazzup'; $last_exec['whazzup'] = 0; if ($globalDebug) { echo "Connect to whazzup source...\n"; } } else { if (preg_match('/recentpireps/i', $host)) { $formats[$id] = 'pirepsjson'; $last_exec['pirepsjson'] = 0; if ($globalDebug) { echo "Connect to pirepsjson source...\n"; } } else { if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { // Desactivated. Here only because it's possible. Do not use without fr24 rights. //$formats[$id] = 'fr24json'; //$lastexec['fr24json'] = 0; //if ($globalDebug) echo "Connect to fr24 source...\n"; } else { if (preg_match('/10001/', $host)) { $formats[$id] = 'tsv'; if ($globalDebug) { echo "Connect to tsv source...\n"; } } } } } } } } } } else { $hostport = explode(':', $host); $s = create_socket($hostport[0], $hostport[1], $errno, $errstr); if ($s) { $sockets[$id] = $s; if (preg_match('/aprs/', $hostport[0])) { $formats[$id] = 'aprs'; $aprs_connect = 0; } elseif ($hostport[1] == '10001') { $formats[$id] = 'tsv'; } elseif ($hostport[1] == '30002') { $formats[$id] = 'raw'; } elseif ($hostport[1] == '30005') { // Not yet supported $formats[$id] = 'beast'; } else { $formats[$id] = 'sbs'; } if ($globalDebug) { echo 'Connection in progress to ' . $host . '(' . $formats[$id] . ')....' . "\n"; } } else { if ($globalDebug) { echo 'Connection failed to ' . $host . ' : ' . $errno . ' ' . $errstr . "\n"; } } } } }
function connect_all($hosts) { global $sockets, $formats, $globalDebug; foreach ($hosts as $id => $host) { if (filter_var($host, FILTER_VALIDATE_URL)) { if (preg_match('/deltadb.txt$/', $host)) { $formats[$id] = 'deltadbtxt'; } else { if (preg_match('/aircraftlist.json$/', $host)) { $formats[$id] = 'aircraftlistjson'; } else { if (preg_match('/\\/action.php\\/acars\\/data$/', $host)) { $formats[$id] = 'phpvmacars'; } else { if (preg_match('/whazzup/', $host)) { $formats[$id] = 'whazzup'; } else { if (preg_match('/recentpireps/', $host)) { $formats[$id] = 'pirepsjson'; } else { if (preg_match(':data.fr24.com/zones/fcgi/feed.js:', $host)) { // Desactivated. Here only because it's possible. Do not use without fr24 rights. //$formats[$id] = 'fr24json'; } else { if (preg_match('/10001/', $host)) { $formats[$id] = 'tsv'; } } } } } } } } else { $hostport = explode(':', $host); $s = create_socket($hostport[0], $hostport[1], $errno, $errstr); if ($s) { $sockets[$id] = $s; if ($hostport[1] == '10001') { $formats[$id] = 'tsv'; } elseif ($hostport[1] == '30002') { $formats[$id] = 'raw'; } else { $formats[$id] = 'sbs'; } if ($globalDebug) { echo 'Connection in progress to ' . $host . '....' . "\n"; } } else { if ($globalDebug) { echo 'Connection failed to ' . $host . ' : ' . $errno . ' ' . $errstr . "\n"; } } } } }