简体   繁体   English

使用 PHP 获取主机 ipv6

[英]get host ipv6 with PHP

I want to verify the Googlebot using the following function.我想使用以下函数验证 Googlebot。 But this function does not support ipv6但是这个功能不支持ipv6

php document for gethostbyaddr() gethostbyaddr() 的 php 文档

One solution was mentioned in the link below, but it does not work : A solution that does not work下面的链接中提到了一种解决方案,但它不起作用: 一种不起作用 的解决方案

I want to get the domain name and then match it with the following statements:我想获取域名,然后将其与以下语句进行匹配:

google.com google.com

googlebot.com googlebot.com

In the following link, you can see examples of Google IP:在以下链接中,您可以看到 Google IP 的示例:

https://www.lifewire.com/what-is-the-ip-address-of-google-818153 https://www.lifewire.com/what-is-the-ip-address-of-google-818153

Do you know a solution to this issue?你知道这个问题的解决方案吗?

If the client sent the request using IPv4, then you'll get the IPv4 address.如果客户端使用 IPv4 发送请求,那么您将获得 IPv4 地址。 If your server is serving IPV6 they sent the request using IPv6, you'll get the IPv6 address.如果您的服务器正在提供 IPv6,他们使用 IPv6 发送请求,您将获得 IPv6 地址。

A client will send a request to your server using only one protocol.客户端将仅使用一种协议向您的服务器发送请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM