anyway to get real ip address behind proxy?

Discussion in 'General Programming Chat' started by sohom, Mar 31, 2014.

  1. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    988
    Likes Received:
    175
    Location:
    not in Past
    Hello
    is it possible to get real ip address behind proxy?
    I need it for an affiliate program
    It will be great , if it can be done through php or python

    any luck?
     
  2. akacash

    akacash Jr. VIP Jr. VIP

    Joined:
    Jan 16, 2010
    Messages:
    855
    Likes Received:
    626
    Location:
    The Beach, USA
    Someone can correct me on this, but I believe you need to write something in Java to accomplish this. It can be done though.
     
  3. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    988
    Likes Received:
    175
    Location:
    not in Past
    yes, some articles in the net, saying, it needs java/javascript , in that case,what will happen if the bot using a non java browser to view web pages anonymously
     
  4. Gogol

    Gogol Jr. VIP Jr. VIP

    Joined:
    Sep 10, 2010
    Messages:
    3,764
    Likes Received:
    3,296
    Gender:
    Male
    Occupation:
    Dreaming
    Location:
    Pale Blue Dot
    Home Page:
    I posted something that might help:

    Code:
    http://www.blackhatworld.com/blackhat-seo/php-perl/527166-share-very-simple-script-testing-your-current-proxy-anonymity.html
    In a nutshell, you check for the following server variables
    Code:
    $_SERVER['HTTP_X_FORWARDED_FOR'] , $_SERVER['HTTP_VIA'], $_SERVER['X-REAL-IP'], $_SERVER['HTTP_X_PROXY_ID'] , $_SERVER['HTTP_CLIENT_IP']
    If anyone of them are set and having a value, it's a proxy.
     
    • Thanks Thanks x 2
    Last edited: Mar 31, 2014
  5. nxgweb

    nxgweb Newbie

    Joined:
    Oct 24, 2012
    Messages:
    9
    Likes Received:
    1
    Try this php code
     
  6. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    988
    Likes Received:
    175
    Location:
    not in Past
    nxgweb ,its checking ip address only/

    thanks gOgOl
    also I add a flag for $_SERVER['REMOTE_ADDR']
    I checked in my few test
    if host name is different than the ipv4 then it also a proxy for sure

    here the testing url http://tech-8.com/proxyc.php

    source code here:
    Code:
    <?php
    if (!empty($_SERVER["HTTP_CLIENT_IP"]))
    {
    //check for ip from share internet
    $ip = $_SERVER["HTTP_CLIENT_IP"];
    }
    elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
    {
    // Check for the Proxy User
    $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    else
    {
    $ip = $_SERVER["REMOTE_ADDR"];
    }
    // This will print user's real IP Address
    // does't matter if user using proxy or not.
    echo "IPv4: ".$ip;
    
    $via = $_SERVER['HTTP_VIA'];
    $realip=  $_SERVER['X-REAL-IP'];
    $proxyid = $_SERVER['HTTP_X_PROXY_ID'];
    
    echo "<br/>Via: ".$via;
    echo "<br/>realip: ".$realip;
    echo "<br/>proxyid: ".$proxyid;
    
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    
    echo "<br/>Hostname: ".$hostname;
    ?>

    PS: it will more efficient , if some one come with more good proxy checker , like http://www.whatismyip.com/
     
    Last edited: Mar 31, 2014
  7. TorrentCoder

    TorrentCoder Newbie

    Joined:
    Feb 3, 2014
    Messages:
    15
    Likes Received:
    1
    There is no guaranteed way to know about the proxy unless you have a list of all the Proxies Ip addresses that exist (which seems highly unlikely).