|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-07 09:23 UTC] webmaster at smiliz dot info
Description:
------------
OS : windows XP
Apache 2.2.3
PHP 5.2 rc5
getHostByAddr not return host and the performance as reduced !
Reproduce code:
---------------
$fai = @getHostByAddr($_SERVER['REMOTE_ADDR']);
$fai = str_replace(' ','',$fai);
$fai = strtolower($fai);
$rep = explode('.', $fai);
if ( $rep[0] == "" ) {
$reponse = "Inconnu";
}elseif ( $rep[1] == "" ){
$reponse = ucwords($rep[0]);
}else{
$reponse = ucwords($rep[count($rep)-2]).".".strtolower($rep[count($rep)-1]);
}
echo $reponse;
echo var_dump(getHostByAddr($_SERVER['REMOTE_ADDR']));
=> result : string(13) "xxx.xxx.xxx.xxx"
Expected result:
----------------
wanadoo.fr
Actual result:
--------------
xxx.xxx
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 15:00:01 2025 UTC |
Can't reproduce. C:\php -r "var_dump(gethostbyname('wanadoo.fr'));" string(15) "193.252.122.103" C:\php -r "var_dump(gethostbyaddr('193.252.122.103'));" string(25) "hpwoo.wanadooportails.com"