【问题标题】:What is the meaning of "local_ip" and "primary_ip" in cURL output?cURL 输出中的“local_ip”和“primary_ip”是什么意思?
【发布时间】:2019-03-08 10:41:54
【问题描述】:

我正在尝试使用 curl 连接到站点,但它返回错误 503。

我想也许该网站阻止了我的 IP。我为我的 VPS 购买了另一个 IP 并使用此 IP 连接到该站点,但仍然无法连接并出现相同的错误。

我查看cURL 输出,发现我的两个请求具有相同的主 IP 但不同的本地 IP。

主 IP 不在我购买的 IP 列表中。 cURL 输出中的主 IP 代表什么?

Array ( 
  [url] => http://adsl.tci.ir/ 
  [content_type] => text/html; charset=UTF-8 
  [http_code] => 302 
  [header_size] => 366 
  [request_size] => 50 
  [filetime] => -1 
  [ssl_verify_result] => 0 
  [redirect_count] => 0 
  [total_time] => 0.01543 
  [namelookup_time] => 0.004182 
  [connect_time] => 0.0057 
  [pretransfer_time] => 0.005737 
  [size_upload] => 0 
  [size_download] => 13458 
  [speed_download] => 872197 
  [speed_upload] => 0 
  [download_content_length] => -1 
  [upload_content_length] => 0 
  [starttransfer_time] => 0.015135 
  [redirect_time] => 0 
  [redirect_url] => http://adsl.tci.ir/panel 
  [primary_ip] => 217.218.86.7 
  [certinfo] => Array ( ) 
  [primary_port] => 80 
  [local_ip] => 185.208.174.63 
  [local_port] => 57646 
)

【问题讨论】:

  • 从命令提示符运行 ping adsl.tci.ir 将解析为 217.218.86.7 作为目标 IP 地址。所以primary IP 是您发送请求的地址。它是在 DNS 中映射到 adsl.tci.ir 的 IP 地址。因此,它不在您购买的 IP 地址列表中也就不足为奇了。
  • P.S.我尝试在浏览器中访问 http://adsl.tci.ir/panel 并收到 504 Gateway timeout 错误 - 真的类似于您的 503 错误。我发送的ping 请求也超时而没有得到响应。所以我怀疑这个网站只是离线。在花钱购买第二个 IP 地址之前,您是否尝试过从另一个地方(例如,只是您的本地计算机)对其进行测试?是什么让你得出你被屏蔽的结论?

标签: php http curl ip-address


【解决方案1】:

本地 IP 是您本地的 IP。即它是您的 IP 地址。

主 IP 是您向其发出请求的 IP。即 adsl.tci.ir 解析到的 IP。

[ ~ ] ➜  host adsl.tci.ir
adsl.tci.ir has address 217.218.86.7

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-03
    • 2016-07-17
    • 2021-02-09
    • 1970-01-01
    • 2021-10-11
    • 2014-06-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多