我正在使用PHP的fopen
连接到其他网站,但它不起作用。请求服务器使用代理,目标服务器使用https。所以这里是上下文配置:
["http"]=> array(5) {
["method"]=> string(3) "GET"
["ignore_errors"]=> int(1)
["header"]=> string(197) "Content-type: application/x-www-form-urlencoded Authorization: Basic ...."
["proxy"]=> string(23) "tcp://192.168.83.6:8080"
["request_fulluri"]=> bool(true)
}
给出回复:Bad Request. Your browser sent a request that this server could not understand.
所以我搜索了一下并遵循一些指南,这是我使用ssl代理协议的新配置:
["http"]=> array(5) {
["method"]=> string(3) "GET"
["ignore_errors"]=> int(1)
["header"]=> string(197) "Content-type: application/x-www-form-urlencoded Authorization: Basic ...."
["proxy"]=> string(23) "ssl://192.168.83.6:8080"
["request_fulluri"]=> bool(true)
},
//http://www.php.net/manual/en/context.ssl.php
'ssl' => array(
'verify_peer' => true,
'allow_self_signed' => true,
'cafile' => '/etc/ssl/certs/ca-certificates.crt',
'verify_depth' => 5,
'CN_match' => 'somesite.com',
'disable_compression' => true,
'SNI_enabled' => true,
)
错误:Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:func(119):reason(252) in ...php on line 237 Warning: fopen(): Failed to enable crypto in ...
启用OpenSSL支持
OpenSSL库版本OpenSSL 0.9.8o 2010年6月1日
OpenSSL标题版本OpenSSL 0.9.8o 2010年6月1日
请帮忙!