【发布时间】:2013-04-21 20:13:50
【问题描述】:
如何修复此 HTTPS 错误?
当我遇到以下错误时,我正在尝试学习如何将 Twitter's REST API 与 CodeIgniter 一起使用
遇到了 PHP 错误
严重性:警告
消息:file_get_contents() [function.file-get-contents]:无法 找到包装器“https” - 您是否忘记启用它 配置PHP?
文件名:controllers/search.php
行号:36
遇到了 PHP 错误
严重性:警告
$a = json_decode(file_get_contents('https://api.twitter.com/1.1/statuses/mentions_timeline.json?@stackexchange'), true);
var_dump($a);
[function.file-get-contents]:打开流失败:没有这样的文件或 目录
文件名:controllers/search.php
行号:36
使用以下代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Search extends CI_Controller {
public function index()
{
$a = json_decode(file_get_contents('https://api.twitter.com/1.1/statuses/mentions_timeline.json?@stackexchange'), true);
var_dump($a);
//$this->load->view('search_page');
}
}
/* End of file search.php */
/* Location: ./application/controllers/search.php */
【问题讨论】:
-
您是否检查过是否为 PHP 编译/启用了 SSL 支持?运行
phpinfo();查看。
标签: php json codeigniter twitter