0

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:

gethostbyaddr($_SERVER['REMOTE_ADDR']);

Fixed Now:it returns my IP address, not my host name or ISP.

I tried the solution mentioned here. It's no longer working.

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

Any other solution to achieve this? Info i want to get About Visitor's IP:

The Solution needs to be in php, or a way to do it in php.

P.S I already know, it is not reliable enough to count on this data, as this data can be tricked easily. But my system only demands this data. Even if it is not reliable enough.

Community
  • 1
  • 1
Thomas Cox
  • 309
  • 4
  • 12
  • Not all IPs have reverse mappings defined in DNS, and not all reverse mappings are easily identifiable as to who owns them. – Marc B May 05 '12 at 04:58
  • I never said, that i want info about all IPs, Reputed Companies and organisation will have info. in this regard. – Thomas Cox May 05 '12 at 05:00
  • Now having looked at your images... all that for just a couple textual error messages you could've easily typed in here? Both indicate that your PHP install has url fopen and curl disabled. – Marc B May 05 '12 at 05:01
  • @MarcB, On my Shared hosting and local host, neither fopen is disabled nor curl. – Thomas Cox May 05 '12 at 05:04
  • 2
    if curl wasn't disabled, then curl_init would exist. – Marc B May 05 '12 at 05:07
  • Sorry, my fault. It's working now. But can you please answer.Perfectly working now. How can i use Curl to extract same data as described here using http://stackoverflow.com/questions/855967/how-do-i-retrieve-the-visitors-isp-through-php – Thomas Cox May 05 '12 at 05:24

3 Answers3

2

If you want realible data, you should not depend on the PTR (reverse DNS) records as they can often be set by the users themselves or not at all.

Instead you can use the RIS WHOIS service provided by RIRs, such as RIPE. That kind of query will return you exactly who "owns" the IP address block that your client is connecting from. An example of such a query is here.

See http://www.ripe.net/data-tools/stats/ris/riswhois for details

0

For a rough approximation, phpWhois might give you something usable. That said, don't count on it! What if they're VPN'ed from another location? Running something like Tor to anonymize their connection? On a Starbucks Wi-Fi network? "Borrowing" a neighbor's open network? There are just too many variables to get a dependable answer, so don't treat any results as authoritative.

Kirk Strauser
  • 30,189
  • 5
  • 49
  • 65
0

it returns my IP address, not my host name or ISP.

means your server is misconfigured.
You have to move your site to some other ISP, who have a clue.

to clarify: it's REMOTE_ADDR variable that is misconfigured, not whatever resolver or stuff.
So, before trying to whois whatever IP, you have to get that IP first.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345