Anthony
Anthony

Reputation: 4050

HTTPS error CodeIgniter Twitter REST API

How do I fix this HTTPS error?

I was trying to learn how to use Twitter's REST API with CodeIgniter when I encountered the following error

A PHP Error was encountered

Severity: Warning

Message: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?

Filename: controllers/search.php

Line Number: 36

A PHP Error was encountered

Severity: Warning

$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]: failed to open stream: No such file or directory

Filename: controllers/search.php

Line Number: 36

with the following code:

<?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 */

Upvotes: 1

Views: 599

Answers (1)

raidenace
raidenace

Reputation: 12836

You will also need to make sure that php_openssl, .dll or .so based on your OS is enabled..

Upvotes: 4

Related Questions