2011-06-11 116 views
0

可能重复:
file_get_contents() returns “failed to open stream” when hitting HTTPS问题来打开的file_get_contents(PHP)的远程安全文件

我怎么能打开https://~网址的file_get_contents?有可能做到?

我得到“未能打开流:没有错误的〜

+2

是否启用openssl扩展? – 2011-06-11 22:30:18

+0

你的意思是SecFilterEngine? – Duds200 2011-06-11 22:32:12

+0

SecFilterEngine我相信引用mod_security。你需要检查你的php安装,并确保你在php.ini中启用了openssl扩展 – 2011-06-11 22:33:06

回答

0

我认为这是比较容易,只需使用卷曲,因为你可以做一些更多的东西与它

很基本的:

$ch = curl_init("https://url.to/secured.file"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$file = curl_exec($ch);