• 0

Showing ISP Name using PHP


Question

6 answers to this question

Recommended Posts

  • 0

But that gives you a garbled bic81840184.hostname.com

What I use is this:

<?php
function cleanhost($host) {
   if (ereg('^([0-9]{1,3}\.){3}[0-9]{1,3}$', $host)) {
       return(ereg_replace('\.[0-9]{1,3}$', '*', $host));
   } else {
       return(ereg_replace('^.{' . strpos($host, '.') . '}', '', $host));
   }
}

$hostin = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$echo($hostin);
?>

-Ax

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.