php - Why convert IP Address to Hostname by used "gethostbyaddr" but don't work? -


i try convert ip address hostname used "gethostbyaddr" don't work. use file.text log file analyze page user used lot or less. try cut sentence use array. code.

$file=fopen("log.txt","r");               while (!feof($file)) {     $buffer = fgets($file, 4096);                          $text= explode(" ",$buffer,10);        $text_2=@$text[1];       $ip=substr($text_2,1,11);            $ip2=gethostbyaddr($ip);      echo"insert `log` values ('$ip2');"."<br>";        //show results      //echo"<br>";           //new line }  fclose($file);                               

thanks

that means gethostbyaddr failed.

not because input, find explanation in php documentation

http://php.net/manual/en/function.gethostbyaddr.php

"returns host name on success, unmodified ip_address on failure, or false on malformed input."


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -