note 64527 added to function.gethostbyaddr

From: Date: Mon, 17 Apr 2006 21:08:57 +0000
Subject: note 64527 added to function.gethostbyaddr
Groups: php.notes 
Request: Send a blank email to php-notes+get-108359@lists.php.net to get a copy of this message
Just wanted to contribute for the solaris folks out there that don't have "host" installed. This will return the resolved named of the specified ip address if it exist. NOTE: The " " in the explode statement should be a tab character. explode was used instead of preg_split in order to eliminate regular expression overhead. <? function gethost($ipaddress) { $host = trim( getent hosts $ipaddress ); $host=explode(" ",$host); if(isset($host[1])) return $host[1]; else return ""; } ?> ---- Server IP: 66.163.161.117 Probable Submitter: 132.239.233.32 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.gethostbyaddr.php Edit -- http://master.php.net/note/edit/64527 Del: integrated -- http://master.php.net/note/delete/64527/integrated Del: useless -- http://master.php.net/note/delete/64527/useless Del: bad code -- http://master.php.net/note/delete/64527/bad+code Del: spam -- http://master.php.net/note/delete/64527/spam Del: non-english -- http://master.php.net/note/delete/64527/non-english Del: in docs -- http://master.php.net/note/delete/64527/in+docs Del: other reasons-- http://master.php.net/note/delete/64527 Reject -- http://master.php.net/note/reject/64527 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#108359) next »