note 19953 added to function.gethostbyname

From: Date: Sat, 16 Mar 2002 15:27:12 +0000
Subject: note 19953 added to function.gethostbyname
Groups: php.notes 
Request: Send a blank email to php-notes+get-27855@lists.php.net to get a copy of this message
<?php //script to see if host exists on Internet //following up on the above point about host name //checking and SQL timeouts, run this test script //and see how long it takes for 2nd call to //hostname check to fail //NOTE -- not PHP's fault -- nature of DNS //A known good dns name (my own) $nametotest = "fuzzygroup.com"; //Call address test function testipaddress($nametotest); //A known bad name (trust me) $nametotest = "providence.mascot.com"; //Call address test function testipaddress($nametotest); //ip address checking function //for real use should have a return value but example code function testipaddress ($nametotest) { $ipaddress = $nametotest; $ipaddress = gethostbyname($nametotest); if ($ipaddress == $nametotest) { echo "No ip address for host, so host " . "not currently available in DNS and " . "probably offline for some time<BR>"; } else { echo "good hostname, ipaddress = $ipaddress<BR>"; } } //Recommended fix for sql applications: // store url to temporary table // run second process periodically to // check urls and update main table ?> -- http://www.php.net/manual/en/function.gethostbyname.php http://master.php.net/manage/user-notes.php?action=edit+19953 http://master.php.net/manage/user-notes.php?action=delete+19953 http://master.php.net/manage/user-notes.php?action=reject+19953

« previous php.notes (#27855) next »