Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mvnp
Created January 7, 2018 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvnp/77e90716426495801f945aaa742856e8 to your computer and use it in GitHub Desktop.
Save mvnp/77e90716426495801f945aaa742856e8 to your computer and use it in GitHub Desktop.
<?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