【发布时间】:2010-11-20 21:34:49
【问题描述】:
我需要通过这个简单的命令使用 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 wrapper,结果是No.
那么,我知道如何使用 php 检索这个 https 页面吗?也许与 CURL 任何示例代码?非常感谢!
【问题讨论】: