note 55933 added to function.checkdnsrr

From: Date: Thu, 18 Aug 2005 07:30:56 +0000
Subject: note 55933 added to function.checkdnsrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-93825@lists.php.net to get a copy of this message
I was using file_get_contents on a set of URLs. Some of them URLs were invalid (the structure of it was ok but the DNS hosts couldn't resolve them) and I kept getting an annoying warning that I wanted to handle correctly. I wanted to check the DNS somehow but the existing check dns function in php doesn't have one for windows and the one a person supplied here does not work 100% of the time. (The reg exp is wrong.) Instead use gethostbyname to try to resolve a host. This won't throw any warnings, you just need to check the output and it's all handled gracefully. You'll get the same warnings with fopen and fsockopen. The only minor drawback is that on invalid hosts it takes a couple seconds to figure it out. ---- Manual Page -- http://www.php.net/manual/en/function.checkdnsrr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55933 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55933&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55933&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93825) next »