foundSites = $this->loadKnownWebSDRs(); } /** * Carrega uma lista de WebSDRs conhecidos */ private function loadKnownWebSDRs() { return [ [ 'url' => 'http://websdr.ewi.utwente.nl:8901/', 'name' => 'University of Twente WebSDR', 'location' => 'Netherlands', 'status' => 'unknown' ], [ 'url' => 'http://websdr.su.domains/', 'name' => 'SDR University', 'location' => 'Unknown', 'status' => 'unknown' ], [ 'url' => 'http://kiwisdr.com/public/', 'name' => 'KiwiSDR Public Directory', 'location' => 'Global', 'status' => 'unknown' ], [ 'url' => 'http://sdr.hu/', 'name' => 'SDR.hu Directory', 'location' => 'Global', 'status' => 'unknown' ], [ 'url' => 'http://websdr.org/', 'name' => 'WebSDR.org', 'location' => 'Global', 'status' => 'unknown' ], [ 'url' => 'http://rx.linkfanel.net/', 'name' => 'Linkfanel WebSDR', 'location' => 'Europe', 'status' => 'unknown' ], [ 'url' => 'http://websdr.zepto.cz/', 'name' => 'Zepto WebSDR', 'location' => 'Czech Republic', 'status' => 'unknown' ] ]; } /** * Executa todas as estratégias de busca */ public function findAllWebSDRs() { echo "Iniciando busca por WebSDRs...
"; flush(); // Estratégia 1: Verificar sites conhecidos $this->checkKnownSites(); // Estratégia 2: Buscar em APIs públicas (simulado) $this->searchWithAPIs(); // Estratégia 3: Procurar em diretórios especializados $this->searchDirectories(); // Estratégia 4: Buscar em fóruns e comunidades $this->searchCommunities(); // Verificar status dos sites encontrados $this->checkSitesStatus(); return $this->foundSites; } /** * Verifica os sites conhecidos */ private function checkKnownSites() { echo "Verificando sites conhecidos...
"; flush(); foreach ($this->foundSites as &$site) { $site['status'] = $this->checkSite($site['url']) ? 'online' : 'offline'; } } /** * Simula busca usando APIs (em um caso real, usaria APIs de search) */ private function searchWithAPIs() { echo "Buscando através de APIs...
"; flush(); // Simulação de resultados de API $apiResults = [ [ 'url' => 'http://hackgreensdr.org:8901/', 'name' => 'HackGreen SDR', 'location' => 'UK' ], [ 'url' => 'http://websdr.ce3og.com:8901/', 'name' => 'CE3OG WebSDR', 'location' => 'Chile' ], [ 'url' => 'http://sdrswe.com:8901/', 'name' => 'SDR Sweden', 'location' => 'Sweden' ] ]; foreach ($apiResults as $result) { if (!$this->siteExists($result['url'])) { $result['status'] = 'unknown'; $this->foundSites[] = $result; } } } /** * Procura em diretórios especializados */ private function searchDirectories() { echo "Verificando diretórios especializados...
"; flush(); // Simulação de descoberta em diretórios $directoryResults = [ [ 'url' => 'http://websdr.radioplayer.co.uk:8901/', 'name' => 'RadioPlayer UK SDR', 'location' => 'UK' ], [ 'url' => 'http://sdr.radioamador.com:8901/', 'name' => 'Radioamador SDR', 'location' => 'Brazil' ] ]; foreach ($directoryResults as $result) { if (!$this->siteExists($result['url'])) { $result['status'] = 'unknown'; $this->foundSites[] = $result; } } } /** * Simula busca em comunidades e fóruns */ private function searchCommunities() { echo "Buscando em comunidades e fóruns...
"; flush(); // Simulação de descoberta em comunidades $communityResults = [ [ 'url' => 'http://hamsdr.radio:8901/', 'name' => 'Ham Radio SDR', 'location' => 'Unknown' ], [ 'url' => 'http://websdr.shortwave.radio:8901/', 'name' => 'Shortwave Radio SDR', 'location' => 'Global' ] ]; foreach ($communityResults as $result) { if (!$this->siteExists($result['url'])) { $result['status'] = 'unknown'; $this->foundSites[] = $result; } } } /** * Verifica se um site já existe na lista */ private function siteExists($url) { foreach ($this->foundSites as $site) { if ($site['url'] === $url) { return true; } } return false; } /** * Verifica o status de todos os sites */ private function checkSitesStatus() { echo "Verificando status dos sites...
"; flush(); foreach ($this->foundSites as &$site) { if ($site['status'] === 'unknown') { $site['status'] = $this->checkSite($site['url']) ? 'online' : 'offline'; } } } /** * Verifica se um site está online */ private function checkSite($url) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => $this->userAgents[array_rand($this->userAgents)], CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_NOBODY => true ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ($httpCode >= 200 && $httpCode < 400); } /** * Exibe os resultados em uma interface amigável */ public function displayResults() { $onlineSites = array_filter($this->foundSites, function($site) { return $site['status'] === 'online'; }); $offlineSites = array_filter($this->foundSites, function($site) { return $site['status'] === 'offline'; }); echo ' Localizador de WebSDRs

🌐 Localizador de WebSDRs

Última atualização: ' . date('d/m/Y H:i:s') . '
' . count($this->foundSites) . ' Total de WebSDRs
' . count($onlineSites) . ' WebSDRs Online
' . count($offlineSites) . ' WebSDRs Offline

WebSDRs Disponíveis

'; foreach ($this->foundSites as $site) { $statusClass = $site['status'] === 'online' ? 'online' : 'offline'; $statusText = $site['status'] === 'online' ? 'Online' : 'Offline'; echo '
' . htmlspecialchars($site['name']) . '
' . htmlspecialchars($site['url']) . '
' . htmlspecialchars($site['location']) . '
' . $statusText . '
Acessar WebSDR
'; } echo '
'; } } // Executar a busca e exibir resultados $finder = new AdvancedWebSDRFinder(); $sites = $finder->findAllWebSDRs(); $finder->displayResults(); ?>