当向具有无效 SSL 证书(Cloudflare 必须重新颁发证书)的服务器发出 POST 请求时,Artax 返回以下错误:
stream_socket_enable_crypto():SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
我试图使用
$client->setOption('tlsOptions', [
'verify_peer' => FALSE,
]);
和
$request->setOption('tlsOptions', [
'verify_peer' => FALSE,
]);
但是,在这两种情况下都会引发错误。
任何人都可以阐明使用 Artax 禁用对等验证的正确方法吗?
更新
我都试过了:
$client->setAllOptions([
'tlsOptions' => [
'verify_peer' => FALSE,
'allow_self_signed' => TRUE,
],
]);
和
$client->setOption('tlsOptions', [
'verify_peer' => FALSE,
'allow_self_signed' => TRUE,
]);
两者都给我 400(错误请求)的响应。
[status:Artax\Response:private] => 400
[reason:Artax\Response:private] => Bad Request
[protocol:Artax\Message:private] => 1.1
[headers:Artax\Message:private] => Array
(
[Date] => Array
(
[0] => Mon, 19 May 2014 09:50:19 GMT
)
[Server] => Array
(
[0] => Apache/2.4.9 (Ubuntu)
)
[Content-Length] => Array
(
[0] => 303
)
[Connection] => Array
(
[0] => close
)
[Content-Type] => Array
(
[0] => text/html; charset=iso-8859-1
)
)
[headerCaseMap:Artax\Message:private] => Array
(
[DATE] => Date
[SERVER] => Server
[CONTENT-LENGTH] => Content-Length
[CONNECTION] => Connection
[CONTENT-TYPE] => Content-Type
)