【发布时间】:2012-04-21 07:17:34
【问题描述】:
我想使用 pear http_request2($url) 类发出 https 请求。 我可以发出http请求,但不能发出https。并且该网站促进了http和https。服务器响应 https 没有问题。
require 'HTTP/Request2.php';
$url = 'https://collegedb2.ferryfair.com';
$r = new Http_Request2($url);
$r->setMethod(HTTP_Request2::METHOD_POST);
try {
$response = $r->send();
} catch (Exception $exc) {
$es = $exc->getTraceAsString();
$ets=$exc->__toString();
$egc=$exc->getCode();
$egl=$exc->getLine();
$egm=$exc->getMessage();
$egt=$exc->getTrace();
$response = null;
}
$page = $response->getBody();
echo $page;
这是错误信息:
$egm=(string) Unable to connect to ssl://collegedb2.ferryfair.com:443. Error: stream_socket_client(): unable to connect to ssl://collegedb2.ferryfair.com:443 (Unknown error)
【问题讨论】:
-
似乎 ssl 证书未正确安装/配置,连接时出现以下错误:ssl_error_rx_malformed_certificate (SSL3_GET_SERVER_CERTIFICATE:unable to find public key parameters)
-
你尝试连接collegedb2.ferryfair.com ??它仅在我们的本地网络上可用。服务器上的 ssl 证书已正确安装。问题在于 http_request2 类,它无法发出 https 请求。 openssl 在 php 中启用,在 phpinfo() 中检查
标签: php https pear http-request