获取客户端IP而不是代理 [英] Get Client IP instead of Proxy's

查看:86
本文介绍了获取客户端IP而不是代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这里有一百万个答案,但是在你完成所有这些后你还能得到代理的IP而不是客户端?我尝试过很多解决方案,但都没有。我总是最终使用Proxy的IP而不是客户端。任何帮助?

我尝试使用的JS:



i know this has a million answers here, but what do you do when after all this you still get the Proxy's IP instead of the client's? i have tried a lot of solutions, but none of them work. I always end up with Proxy's IP instead of the client's. any help?
the JS i tried to use:

<script type="application/javascript">
  function getIP(json) {
  // document.write("My public IP address is: ", json.ip);
    var ip=json.ip;
    document.getElementById('IPaddr').value = json.ip;

      }
function LoadJsonDataFunction()
{
  $.getJSON("https://api.ipify.org?format=jsonp&callback=getIP", function(obj) {
    $.each(obj.ip, function(key, value){
      $("IPaddr").append(value.ip);
    });
  });
}
 </script>
// <script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>





隐藏的HTML字段的值:



the hidden HTML field's value:

<input type="hidden" name="IPaddr" value="" /> 





但$ _POST ['ip']始终为NULL。



but the $_POST['ip'] is always NULL.

推荐答案

.getJSON(https://api.ipify.org?format=jsonp&callback=getIP,function(obj){
.getJSON("https://api.ipify.org?format=jsonp&callback=getIP", function(obj) {


.each(obj.ip,function (键,值){
.each(obj.ip, function(key, value){


(IPaddr)。append(value.ip);
});
});
}
< / script >
// < script type = application / javascript src = https://api.ipify.org?format=jsonp&callback=getIP > < / script >
("IPaddr").append(value.ip); }); }); } </script> // <script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>





隐藏的HTML字段的值:



the hidden HTML field's value:

<input type="hidden" name="IPaddr" value="" /> 





但是



but the


这篇关于获取客户端IP而不是代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆