How can I use PHP to ping An address TITLE! -- ************************** Meng Xianhui * amxh@21cn.com * elove.heha.net * go.163.com ~ Colorweb ************************** -- HEADBODYBGCOLOR # fffffor#hodpostaction? Ph Ping
How to ping An address using PHP?
If ($ server = '192. 0.0.1 ') | ($ server = 'localhost') | ($ server = getenv ("SERVER_ADDR "))){
Echo"
";
Echo "Fuck Off!
";
Echo"
";
Exit;
} Else {
If ($ server = ""){
Echo "enter url or IP address :";
Exit;
}
$ Ip = getenv ("REMOTE_ADDR ");
$ Hname = getenv ("HTTP_HOST ");
Echo"Your IP is: $ Ip
"
."Trying to ping: $ Server
"
."Using server: $ Hname";
Echo"
";
Echo"STATS:
";
$ Command = "ping-c4 $ server ";
Exec ($ command, $ result, $ rval );
If (count ($ result) <= 0 ){
Echo "no response
";
Echo"
";
Exit;
}
For ($ I = 0; $ I <count ($ result); $ I ++ ){
Echo "$ result [$ I]
";
}
Echo"
";
# Include ("powered.txt ");
}
?>