- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在 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/
我在 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.
我在两台不同的服务器上有 example.com,我使用 php curl 连接到一台服务器,执行一些任务,然后尝试连接到另一台服务器并执行其他一些任务,但它第二次不遵守 CURLOPT_RESOLV
请考虑此代码片段,我需要有关更改 libcurl 中的 CURLOPT_RESOLVE 的指导 //snip #include #include "myown_dns_client.h" //jus
我是一名优秀的程序员,十分优秀!