gpt4 book ai didi

php CURLOPT_RESOLVE 不起作用

转载 作者:搜寻专家 更新时间:2023-10-31 21:20:46 27 4
gpt4 key购买 nike

我在 Centos 6,PHP 5.6.35,

curl 7.59.0 (x86_64-redhat-linux-gnu) libcurl/7.59.0 OpenSSL/1.0.1ezlib/1.2.3 c-ares/1.14.0 libssh2/1.8.0 nghttp2/1.6.0

我正在尝试强制 curl 使用带 HTTPS 的 IP(我局域网中的网络服务器):

  curl_setopt($ch, CURLOPT_URL, "https://" . $domain . "/");
curl_setopt($ch, CURLOPT_RESOLVE, array( $domain . ":443:192.168.1.10"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$output = curl_exec($ch);

它一直连接到 $domain 的真实公共(public) IP。我也明白了:

PHP Notice: Use of undefined constant CURLOPT_RESOLVE - assumed 'CURLOPT_RESOLVE' in ...

PHP Warning: curl_setopt() expects parameter 2 to be long, string given in ...

最佳答案

出于某种原因,来自 city-fan 的 curl 7.59 版本不起作用。

我已经在 Centos 7 上测试过

curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.21 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.4.3

而且有效。

关于php CURLOPT_RESOLVE 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49908407/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com