function ping_server($ip,$port) { $ping = @fsockopen($ip,$port,$errno,$errstr,0.4); if($ping) return 1; else return 0; }