2013-04-27 95 views
1

如何解決此HTTPS錯誤?HTTPS錯誤CodeIgniter Twitter REST API

我是想學習如何使用Twitter's REST API使用CodeIgniter時,我遇到了以下錯誤

一個PHP錯誤遇到

嚴重性:警告

消息:file_get_contents()函數[函數.file-get-contents]:找不到 找到包裝器「https」 - 你配置PHP時是否忘記啓用它 ?

文件名:控制器/ search.php中

行號:遇到36

甲PHP錯誤

嚴重性:警告

$a = json_decode(file_get_contents('https://api.twitter.com/1.1/statuses/[email protected]'), true); 
     var_dump($a); 

[function.file - 內容]:未能打開流:沒有這樣的文件或 目錄

文件名:控制器/ 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/[email protected]'), true); 
     var_dump($a); 

     //$this->load->view('search_page'); 
    } 
} 

/* End of file search.php */ 
/* Location: ./application/controllers/search.php */ 
+1

你檢查,看看你是否有SSL suppo rt編譯/啓用PHP?運行'phpinfo();'來查看。 – 2013-04-27 21:35:50

+1

http://stackoverflow.com/questions/1975461/file-get-contents-with-https – 2013-04-27 21:36:03

+0

+1神祕和可以,謝謝 – Anthony 2013-04-27 21:54:19

回答

3

您還需要確保php_openssl.dll or .so基於您的操作系統啓用..

+0

+1它被禁用,謝謝 – Anthony 2013-04-27 21:54:59