ipv6代理测试

php解析ipv6 only失败 PHP curl failing to resolve IPv6-only URL

php利用curl做相关ipv6解析时候失败,代码片断可能是这样:

<?php

$ch = curl_init('https://ipv6.moneyslow.com');
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_VERSION_IPV6);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_exec($ch);

解决办法:
参数用错了,没有 CURL_VERSION_IPV6

应该是 CURL_IPRESOLVE_V6

对于 CURLOPT_IPRESOLVE ,默认是 CURL_IPRESOLVE_WHATEVER
可选: CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V6