【问题标题】:whatsmyip gives different IP from file_get_contents than browserwhatsmyip 从 file_get_contents 提供与浏览器不同的 IP
【发布时间】:2014-06-20 17:03:16
【问题描述】:

我的路由器上有一个静态 IP。我的电脑在本地主机上运行 apache。 当我在浏览器中打开 www.whatsmyip.org 时,我得到了从 ISP 分配的静态 IP。 当我跑步时

<?php
echo file_get_contents("http://www.whatsmyip.org"); 

在浏览器的 apache 中,在我的 PC 的 localhost 服务器上,每次运行它时都会显示不同的 IP。 问题出在哪里?我的 ISP?我的阿帕奇配置? get_file_contents 在 URL 上的工作方式?

【问题讨论】:

  • 应该是同一个ip
  • 您的浏览器是否使用了某种代理?
  • 任何代理?
  • 不涉及代理:PC - 分配了静态 IP 的路由器 - ISP。
  • 我也试过了,同样的事情。每次刷新 php 脚本时 IP 都会发生变化。

标签: php apache static-ip-address


【解决方案1】:

这很有趣。我花了一段时间,但很享受。

该网站的来源包含:

<div>
    <!-- Please DO NOT use this site to power an IP bot, script or other IP-lookup software! -->
    <h1>Your IP Address is <span id="ip">a random ip</span></h1>
</div>

这是一种反僵尸机制(他们甚至警告过它:D)。在页面加载时,它会使用 Java Script 替换为您的实际 IP。

我检查了其他网站,其中大多数都使用类似的机制。

如果你需要检查,这个没有 http://whatsmyip.net/

【讨论】:

    猜你喜欢
    • 2011-02-02
    • 2011-12-29
    • 2012-10-06
    • 1970-01-01
    • 2019-04-15
    • 2015-06-11
    • 2016-01-13
    • 2018-12-23
    相关资源
    最近更新 更多