I am trying to make a code the same as the one which micro torrent use to check whether a port is open:
http://www.utorrent.com/testport.php?port=222
Just now I have this:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ip = "udp://$ip";
$fp = fsockopen($ip, 222, $errno, $errstr, 30);
if (!$fp) {
echo "$ip<br>Not Open";
} else {
echo "$ip<br>Open";
}
?>
But it is not working as it always says open even if it is not. Where have I gone wrong. Is there another way to do this?