使用PHP脚本测试用户HTTP代理

时间:2011-03-26 13:17:20

标签: php proxy

欢迎,

我正在编写应用程序,这将允许我尝试检测已安装的HTTP代理用户类型。

脚本调用远程服务器添加参数http://xxxx.php?my_ip=real_IP

这是我的申请:

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$real_ip=$_GET['my_ip'];


$ip1=$_SERVER['HTTP_X_FORWARDED_FOR'];
$ip2=$_SERVER['HTTP_X_FORWARDED'];
$ip3=$_SERVER['HTTP_FORWARDED_FOR'];
$ip4=$_SERVER['HTTP_CLIENT_IP'];
$ip5=$_SERVER['HTTP_VIA'];

$ip6=$_SERVER['REMOTE_ADDR'];

$ip_array[1]=$ip1;
$ip_array[2]=$ip2;
$ip_array[3]=$ip3;
$ip_array[4]=$ip4;
$ip_array[5]=$ip5;


if($ip6==$real_ip)
{
  echo "You are not using proxy.";  
}
else
{

if(in_array($real_ip, $ip_array))
{
    echo "You are using transparent proxy with one releave your ip.";
}
else
{

    if( $_SERVER['HTTP_X_FORWARDED_FOR']
   || $_SERVER['HTTP_X_FORWARDED']
   || $_SERVER['HTTP_FORWARDED_FOR']
   || $_SERVER['HTTP_CLIENT_IP']
   || $_SERVER['HTTP_VIA'])
    {
    echo "You are using anonymous proxy with one protect Your IP but inform www servers about using proxy";    
    }
    else
    {
    echo "You are using elite proxy, with one hide your IP and don't inform www servers about using proxy";    
    }


}
}




$table=<<<table

<p>Ip  HTTP_X_FORWARDED_FOR FOR : $ip1</p>
<p>Ip  HTTP_X_FORWARDED  : $ip2</p>
<p>Ip  HTTP_FORWARDED_FOR FOR : $ip3</p>
<p>Ip  HTTP_CLIENT_IP FOR : $ip4</p>
<p>Ip  HTTP_VIA FOR : $ip5</p>
<p>Ip  remote addr  : $ip6</p>

table;
echo $table;

?>

我运行了一些测试,应用程序看起来非常好。

如果您有任何提示,请告诉我。

我的意思是我想知道我不会错过重要的事情。

此致

1 个答案:

答案 0 :(得分:0)

一些主要参与者(Paypal,eBay,具有高安全性的网站等)查找代理的另一种方法是使用gethostbyaddr()查找您的IP主机名,这可以揭示可能是代理的来源E.g. server.squid.com(很明显的例子向你展示我的意思!)