Skip to content

LaalyS/API--SWOW--SEVER--TESTER---PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

API--SWOW--SEVER--TESTER---PHP

for ($i = $inicio; $i <= $fim; $i++) { $ip = "$baseIp.$i"; $resultadoPing = shell_exec("ping -n 1 -w 500 $ip");

// Converte a saída para UTF-8 usando iconv
$resultadoPingUtf8 = iconv('Windows-1252', 'UTF-8//IGNORE', $resultadoPing);

$status = (strpos($resultadoPingUtf8, "TTL=") !== false) ? 'ocupado' : 'livre';

// Adiciona o resultado convertido ao array
$resultados[] = [
    'ip' => $ip,
    'status' => $status,
    'saida' => $resultadoPingUtf8 // saída já convertida
    
];

}$resultado = shell_exec("ping -n 1 -w 500 $ip"); if ($resultado !== null) { // Converte a saída do ping de CP850 para UTF-8 $resultado = iconv('CP850', 'UTF-8//IGNORE', $resultado); }

<title>Teste de IPs</title>

..... todo o resto

$resultado = shell_exec("ping -n 1 -w 500 $ip"); $resultado = iconv('CP850', 'ISO-8859-1//IGNORE', $resultado);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published