[英]Alternatives to fsockopen - (very slow)?
Does anyone know an alternative to @fsockopen? 有人知道@fsockopen的替代方法吗? I'm trying to detect proxies -- user hits site, grab users IP address, then use @fsockopen to see if they are using a specific port.Using this function is BY FAR the most reliable for detecting, outside of banning specific IPs / IP Patterns.
我正在尝试检测代理-用户访问站点,获取用户IP地址,然后使用@fsockopen来查看他们是否正在使用特定端口。使用此功能是BY FAR最可靠的检测方法,除了禁止特定IP / IP模式。 However, it's very slow and un-acceptable for users visiting my site.
但是,这对于访问我的网站的用户而言非常缓慢且令人无法接受。 Is there any other options, or a way to make it faster?
还有其他选择,还是一种使其更快的方法? And no setting the timeout of the function to 1 second doesn't help :P.
并且没有将函数的超时设置为1秒对:P没有帮助。
Example code: 示例代码:
if ( $sock = @fsockopen($ _server['REMOTE_ADDR'], 80, $errno, $errst, 1) ) { echo "proxy!"; }
Can curl achieve something like this? 卷曲可以达到这样的效果吗?
Thanks in advance! 提前致谢!
Test for $_SERVER['HTTP_X_FORWARDED_FOR']
: 测试
$_SERVER['HTTP_X_FORWARDED_FOR']
:
$is_proxy = isset($_SERVER['HTTP_X_FORWARDED_FOR']);
It's faster and more accurate than your current method. 它比您当前的方法更快,更准确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.