Cara Cek Port Keluar dengan Scipt PHP

Anda bisa melakukan pengecekan Port keluar dengan menggunakan script berikut : 

1. Silahkan Anda membuat file baru dan melkaukan pengisian script : 

<?php
// ini_set(‘max_execution_time’, 0);
// ini_set(‘memory_limit’, -1);
// $host = ‘smtp.gmail.com’;
// // $ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
// $ports = array(25,587);
// foreach ($ports as $port)
// {
// $connection = @fsockopen($host, $port, $errno, $errstr, 2);
// if (is_resource($connection))
// {
// echo ‘<h2>’ . $host . ‘:’ . $port . ‘ ‘ . ‘(‘ . getservbyport($port, ‘tcp’) . ‘) is open.</h2>’ . “\n”;
// fclose($connection);
// }
// else
// {
// echo ‘<h2>’ . $host . ‘:’ . $port . ‘ is not responding.</h2>’ . “\n”;
// }
// }

// $socket = fsockopen(“srv42.niagahoster.com”, 465, $errno, $errstr, 2);
// if(!$socket)
// {
// echo “ERROR: smtp.gmail.com 465 – $errstr ($errno)<br>\n”;
// }
// else
// {
// echo “SUCCESS: smtp.gmail.com 465 – ok<br>\n”;
// }

// $host = ‘smtp.gmail.com’;
$host = ‘smtp.gmail.com’;
$ports = array(25,587,465,);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port, $errno, $errstr, 2);
if (is_resource($connection))
{
echo ‘<h2>’ . $host . ‘:’ . $port . ‘ ‘ . ‘(‘ . getservbyport($port, ‘tcp’) . ‘) is open.</h2>’ . “\n”;
fclose($connection);
}
else
{
echo ‘<h2>’ . $host . ‘:’ . $port . ‘ is not responding.</h2>’ . “\n”;
}
}

2. Silahkan akses script yang Anda buat tersebut.