by
30 4

Codeigniter Curl

Use <a href="https://www.cloudways.com/blog/codeigniter-json-curl/">Codeigniter Curl library</a> to parse data in JSON format.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/4057065/Codeigniter-Curl?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
$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();
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus