Advertisement
Guest User

Api_Connection

a guest
Mar 26th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. // import library dari REST_Controller
  5. require APPPATH . 'libraries/REST_Controller.php';
  6.  
  7. class Api_Connection extends REST_Controller {
  8.     public function __construct(){
  9.         parent::__construct();
  10.         $this->load->model('api_m','api');
  11.     }
  12.  
  13.     public function index_get()
  14.     {
  15.         // testing response
  16.         $response['status'] = 200;
  17.         $response['error'] = false;
  18.         $response['message'] = 'Selamat datang insan muda, masuklah dengan Assalamu alaikum wr.wb';
  19.  
  20.         // tampilkan response
  21.         $this->response($response);
  22.     }
  23.  
  24.     public function monitoring_get(){
  25.         $data = $this->api->api_monitoring();
  26.         if ($data->num_rows() > 0) {
  27.             $data = $data->result();           
  28.         }else{
  29.             $data = null;
  30.         }
  31.         //tampilkan response
  32.         $this->response($data);
  33.     }
  34. }
  35.  
  36.  
  37.  
  38. /* End of file Api_Connection.php */
  39. /* Location: ./application/controllers/Api_Connection.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement