Created
January 7, 2018 14:57
-
-
Save mvnp/77e90716426495801f945aaa742856e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Cripto extends CI_Controller { | |
public function __construct(){ | |
parent::__construct(); | |
} | |
/** | |
* Buscando criptomedas ... | |
* @return [type] [description] | |
*/ | |
public function index(){ | |
$data["linhas"] = $this->getCriptos(); | |
$this->load->view('bootstrap', $data); | |
} | |
/** | |
* Buscando criptos ... | |
* @return [type] [description] | |
*/ | |
private function getCriptos(){ | |
$get = curl_init(); | |
curl_setopt($get, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($get, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($get, CURLOPT_URL, 'https://api.coinmarketcap.com/v1/ticker/'); | |
$result = curl_exec($get); | |
curl_close($get); | |
$string = json_decode($result); | |
return $string; | |
} | |
} | |
/* End of file cripto.php */ | |
/* Location: ./application/controllers/cripto.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment