I\'m using the requests library (http://requests.ryanmccue.info/) for PHP.
I installed composer and added the following Json configuration in composer.json
I will just add some points to a well-written answer by Gopkumar Gopalan to make it work in codeigniter 3.x.
Step 1
Add the Requests library in your composer.json
Step 2
Install dependencies composer install
Step 3
Create a file PHPRequests.php
in {codeigniter_directory}/application/libraries
with this content (Note there is a change in the path of the requests library)
Step 4
In your controller you can use Requests by loading PHPRequests library we created in previous step.
$this->load->library('PHPRequests');
Like this test function
public function test()
{
$this->load->library('PHPRequests');
$response = Requests::get('https://github.com/timeline.json');
var_dump($response->body);
}
Hope it helps someone