php - cURL 输出中的 "local_ip"和 "primary_ip"是什么意思?

标签 php http curl ip-address

我正在尝试使用 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 
)

最佳答案

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

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

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

关于php - cURL 输出中的 "local_ip"和 "primary_ip"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55061471/

相关文章:

rest - 如何抑制来自 CLI CURL 的请求输出的 header

php - Xdebug 在 php.ini 生产性能

php - 查询以获取列的差异

html - CSS文件的浏览器缓存

android - Dart OAuth 1.0 - 无效签名 - 提供的签名不匹配

linux - 有谁知道如何使用CURL下载 "fake"?

php - jquery 自动完成不适用于重音

php - Symfony 尾部斜杠重定向丢弃 HTTPS

http - iOS9 - HTTP 连接错误

php - 在 php 中获取多 curl 响应时,如何控制接收数据的顺序?