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

后端 未结 15 1493
暖寄归人
暖寄归人 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 11:47

    I've attempted to correct Ram Kumar's answer but whenever I would edit their post I would be temporarily banned and my changes were ignored. (As to why, I don't know, It was my first and only edit that I've ever made on this website.)

    Since his post, his code does not work anymore due to website changes and the Administrator implementing basic bot checks (checking the headers):

     array('method' => 'GET', 'header' => "User-Agent: $User_Agent\r\nAccept: $Accept\r\nAccept-Language: $Accept_Language\r\nReferer: $Referer\r\nConnection: $Connection\r\n\r\n"))));
    
    preg_match_all('/(.*?)<\/th>(.*?)<\/td>/s', $HTML, $Matches, PREG_SET_ORDER);
    
    $ISP = $Matches[3][2];
    $City = $Matches[11][2];
    $State = $Matches[10][2];
    $ZIP = $Matches[15][2];
    $Country = $Matches[9][2];
    ?>
    
        
    ISP :
    City :
    State :
    Zipcode :
    Country :

    Note that just supplying a user-agent would probably suffice and the additional headers are most likely not required, I just added them to make the request look more authentic.

提交回复
热议问题