ניסתי משהו כזה:
PHP קוד:
<?php
if (isset($_POST["send"]))
{
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($sock);
socket_connect($sock,$_POST['server'], 22);
socket_set_block($sock);
switch(socket_select($r = array($sock), $w = array($sock), $f = array($sock), 5))
{
case 2:
echo "[-] Connection Refused\n";
break;
case 1:
echo "[+] Connected\n";
break;
case 0:
echo "[-] Timeout\n";
break;
}
}
?>
<FORM action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST">
<TR>
<TD><INPUT type="TEXT" name="server" size=15 maxlength=50 value="<?php echo $_POST["server"]; ?>"></TD>
<TD align="right"><INPUT type="SUBMIT" name="send" value="בדוק"></TD>
</TR>
תראו בעצמכם מה זה מחזיר לי:
http://zeierman.com/socket.php
Warning: socket_connect() [function.socket-connect]: Host lookup failed [-10003]: Unknown server error in /home/shimon/domains/zeierman.com/public_html/socket.php on line 6