file_get_contents() returns quot;failed to open streamquot; when hitting HTTPS(file_get_contents() 返回“未能打开流;访问 HTTPS 时)
问题描述
当我在 HTTPS URL 上调用 file_get_contents() 时,它返回无法打开流".
file_get_contents() is returning "failed to open stream" when I call it on an HTTPS URL.
Warning: file_get_contents(https://google.com) [function.file-get-contents]: failed to open stream: No error in E:\htdocscallback3.php on line 5
相同的调用将使用非 SSL URL.
Same call will work with a non-SSL URL.
起初,我认为这是我的虚拟主机的安全问题,但我已经用 phpinfo() 验证了 allow url open 确实是允许的.我也试过这段代码并验证它有效:
At first, I thought it was a security issue with my webhoster, but I have verified with phpinfo() that allow url open is indeed allowed. I have also tried this code and verified it works:
有人知道为什么 file_get_contents() 使用 HTTPS URL 失败了吗?
Anyone have any ideas why file_get_contents() is failing with an HTTPS URL?
更新: 人们正确地指出这是一个 HTTPS 问题.我的虚拟主机声称这应该可以工作,但不知道如何解决这个问题.任何人都可以为他们的 IIS7 设置提供具体的指导吗?
update: People correctly pointed out this was an HTTPS issue. My webhoster claims this should work, and has no idea how to resolve this. Anyone have specific directions I can give them for their IIS7 setup?
推荐答案
那可能是因为他们使用的是安全协议https
.这很奇怪,在他们的例子中,facebook 给出了类似的例子.
That is probably because they are using the secure protocol https
. This is strange though, in their examples, facebook is giving the similar example.
这篇关于file_get_contents() 返回“未能打开流";访问 HTTPS 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:file_get_contents() 返回“未能打开流";访问 HTTPS 时
- 带有通配符的 Laravel 验证器 2021-01-01
- Laravel 仓库 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01