关于 with message 'file_get_contents(): SSL operation failed with code 的解决办法
在客户的项目中碰到了
with message 'file_get_contents(): SSL operation failed with code
这种报错
关于 file_get_contents PHP 函数 去从url 中获取数据 不能使用的问题
碰到这个问题当时我也很费解、也隐约猜测到是和ssl配置有问题
然后又几经波折各种查找到了一个解决办法,至于有没有根治这个问题具体不清楚
直接上代码吧
1 $arrContextOptions=array( 2 "ssl"=>array( 3 "verify_peer"=>false, 4 "verify_peer_name"=>false, 5 ), 6 );
$url = 'https://www.cupshell.com';
$resoult = file_get_contents($url,false, stream_context_create($arrContextOptions));
完事!!!