oliverrussell
oliverrussell
Reputation Top 10%
Oliver Russell
1 Snippet  (353rd place)
Published
1 Channel
Created
1 Channel
Following
30 points  (1195th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Popular Coder
Junior Autobiographer
Senior Autobiographer

Recent Snippets See all snippets by oliverrussell

public by oliverrussell  175  0  4  0

Codeigniter Curl

Use Codeigniter Curl library to parse data in JSON format.
$this->load->library('Curl');

$url = 'http://your-domin.com/';

$formatJsondata = array(

   'username' => 'authenticate-username',

   'password' => 'password-authentication'

);

$encodedJsonData = json_encode($formatJsondata);

$this->curl->create($url);

$this->curl->option(CURLOPT_HTTPHEADER, array('Content-type: application/json; Charset=UTF-8'));

$this->curl->post($encodedJsonData);

echo $result = $this->curl->execute();
;