oliverrussell
oliverrussell
Reputation Top 10%
Oliver Russell
1 Snippet  (350th place)
Published
1 Channel
Created
1 Channel
Following
Nov 4, 2018
Last Visit
Apr 11, 2018
Registered
30 points  (1157th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Autobiographer
Senior Autobiographer

Recent Snippets See all snippets by oliverrussell

public by oliverrussell created Nov 4, 2018  116  0  3  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();
;