i'm running an hidden service as the final exam of my school, but i've a problem: i have to show that the IP of the same computer which connects to my website can change in a bit , but when i try functions such as $ip=$_SERVER['REMOTE_ADDR'];
it always gives me 127.0.0.1 instead of the last tor node which connects to me. How can i solve this ? Is it normal on the Tor network? Cheers in advance!
我正在运行一项隐藏的服务作为我学校的期末考试,但我有一个问题:我必须证明连接到我的网站的同一台计算机的IP可能会有所改变,但当我尝试这样的功能时as $ ip = $ _ SERVER ['REMOTE_ADDR'];它总是给我127.0.0.1而不是连接到我的最后一个tor节点。我怎么解决这个问题?在Tor网络上是否正常?提前干杯!
1 个解决方案
#1
0
There is a no direct way , but you can try using a third party server to get actual ip even from localhost server.
没有直接的方法,但您可以尝试使用第三方服务器甚至从localhost服务器获取实际的IP。
<?php
$content = file_get_contents('http://checkip.dyndns.com/');
preg_match('/Current IP Address: \[?([:.0-9a-fA-F]+)\]?/', $content, $ip);
echo $externalIp = $ip[1];
?>
Here is a working PHPFiddle . Hope this will help, cheers :)
这是一个有效的PHPFiddle。希望这会有所帮助,欢呼:)
#1
0
There is a no direct way , but you can try using a third party server to get actual ip even from localhost server.
没有直接的方法,但您可以尝试使用第三方服务器甚至从localhost服务器获取实际的IP。
<?php
$content = file_get_contents('http://checkip.dyndns.com/');
preg_match('/Current IP Address: \[?([:.0-9a-fA-F]+)\]?/', $content, $ip);
echo $externalIp = $ip[1];
?>
Here is a working PHPFiddle . Hope this will help, cheers :)
这是一个有效的PHPFiddle。希望这会有所帮助,欢呼:)