file_get_contents()返回“无法打开流”何时点击HTTPS [英] file_get_contents() returns "failed to open stream" when hitting HTTPS
问题描述
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:\\htdocs\callback3.php on line 5
同一个电话将使用非SSL网址。
Same call will work with a non-SSL URL.
起初,我认为这是我的webhoster的一个安全问题,但我已经通过phpinfo()验证了允许url打开确实是允许的。我也试过这个代码,并验证了它的工作原理:
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问题。我的webhoster声称这应该有效,并且不知道如何解决这个问题。任何人都有特定的指示我可以为他们的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!