需要阅读 https 网页,但我的网络服务器不支持 https 包装器
我需要使用 php 通过以下简单命令读取网页内容:
$pagina='https://graph.facebook.com/me?access_token=' . $cookie['access_token'];
$user = json_decode(file_get_contents($pagina));
如您所见,协议是 https。当我执行这个命令时,我总是得到:
[function.file-get-contents]:失败 打开流:
在 stackoverflow 的其他答案中,一些用户建议使用此代码:
$w = stream_get_wrappers();
echo 'openssl: ', extension_loaded ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);
为了知道我的服务器是否有 https 包装器,结果是否定的。
那么,知道如何使用 php 检索此 https 页面吗?也许有 CURL 任何示例代码?多谢!
i need to read the content of a web page using php with this simple command:
$pagina='https://graph.facebook.com/me?access_token=' . $cookie['access_token'];
$user = json_decode(file_get_contents($pagina));
As you can see the protocol is https. When i execute this commands i always get:
[function.file-get-contents]: failed
to open stream:
In other answer in stackoverflow some user suggest to use this code:
$w = stream_get_wrappers();
echo 'openssl: ', extension_loaded ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);
In order to know if my server have https wrapper, and the result was No.
So, any idea of how can i retrive this https page using php? maybe with CURL any example code? Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https 站点可与curl 配合使用
Https sites work with curl