gpt4 book ai didi

PHP GAE 1.9.18 - [Errno 8] _ssl.c :507: EOF occurred in violation of protocol

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:44 24 4
gpt4 key购买 nike

这适用于我的谷歌应用引擎,但在我的开发服务器上,我收到此错误:

Warning: file_get_contents(https://website.com): failed to open stream: Unsupported SSL context options are set. The following options are present, but have been ignored: allow_self_signed<br /> SSL certificate error - certificate invalid or non-existent, [Errno 8] _ssl.c:507: EOF occurred in violation of protocol in

$context = stream_context_create(
array(
'ssl' => array('verify_peer' => false, 'allow_self_signed' => true),
'http' => array( 'method' => 'GET' )
)
);
$call_url = file_get_contents('https://website.com', false, $context);

我正在使用 runtime: php55 .有谁知道为什么会发生这种情况,为什么它可以在 App Engine 上运行,以及我可以做些什么来修复这个错误?

错误报告:https://code.google.com/p/googleappengine/issues/detail?id=11772

最佳答案

最简单的解决方案是改用 curl,如下所示:

function file_get_contents_curl( $url ) {

$ch = curl_init();

curl_setopt( $ch, CURLOPT_AUTOREFERER, TRUE );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, TRUE );

$data = curl_exec( $ch );
curl_close( $ch );

return $data;

}

(向@lord_viper 和 PHP : How to use curl instead file_get_contents? 致敬)

关于PHP GAE 1.9.18 - [Errno 8] _ssl.c :507: EOF occurred in violation of protocol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28996360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com