我想使用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;这是错误消息: (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 禁用证书验证的注释是我的关键。$request = new HTTP_Request2('https://someserver.com/somepath/something', HTTP_Request2::METHOD_POST);$request->setConfig(array( 'ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE)); (adsbygoogle = window.adsbygoogle || []).push({}); 08-03 20:20