I try to convert IP Address to Hostname by used "gethostbyaddr" but don't work. I use file.text that is log file to analyze which page that user used a lot or less. So I try to cut sentence that use array. This is my 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 INTO `log` VALUES ('$ip2');"."<br>"; //Show results
//echo"<br>"; //New line
}
fclose($file);
Thanks