• 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.
  • Posts

  • Recent Achievements

    • Dedicated
      Stephen Leibowitz earned a badge
      Dedicated
    • Dedicated
      Snake Doc earned a badge
      Dedicated
    • One Month Later
      Philsl earned a badge
      One Month Later
    • One Year In
      armandointerior640 earned a badge
      One Year In
    • One Month Later
      armandointerior640 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      613
    2. 2
      ATLien_0
      235
    3. 3
      Xenon
      157
    4. 4
      +FloatingFatMan
      124
    5. 5
      Michael Scrip
      113
  • Tell a friend

    Love Neowin? Tell a friend!