How do I retrieve the visitor's ISP through PHP?

后端 未结 15 1471
暖寄归人
暖寄归人 2020-12-01 11:17

How do I find out the ISP provider of a person viewing a PHP page?

Is it possible to use PHP to track or reveal it?

If I use something like the following:

相关标签:
15条回答
  • 2020-12-01 12:08

    This seems to be what you're looking for, it will attempt to return the full hostname if possible:

    http://us3.php.net/gethostbyaddr

    0 讨论(0)
  • 2020-12-01 12:08

    I think you need to use some third party service (Possibly a web service) to lookup the IP and find the service provider.

    0 讨论(0)
  • 2020-12-01 12:09
    <?php
    $isp = geoip_isp_by_name('www.example.com');
    if ($isp) {
        echo 'This host IP is from ISP: ' . $isp;
    }
    ?>
    

    (PECL geoip >= 1.0.2)

    geoip_isp_by_name — Get the Internet Service Provider (ISP) name

    http://php.net/manual/ru/function.geoip-isp-by-name.php

    0 讨论(0)
提交回复
热议问题