note 79605 deleted from function.fsockopen by danbrown

From: Date: Mon, 18 May 2009 01:47:37 +0000
Subject: note 79605 deleted from function.fsockopen by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155597@lists.php.net to get a copy of this message
Note Submitter: landerretche at free dot fr ---- Make a ping test with PHP The problem with fsockopen is you have to known the destination port. A real ping function could be : <?php function php_ping($url) { $addr=parse_url($url); $host=$addr['host']; exec("ping -c 1 -w 1 $host", $list); if (strpos($list[4],"1 received")>0) { return true ; } return false; } ?> But if your router refuse the ping ... the result will be always false > you may test both (fsockopen and ping)

« previous php.notes (#155597) next »