Advertisement
jamboljack

Npp_Controller

Dec 1st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. class Npp extends CI_Controller {
  2.     function __construct() {
  3.         parent::__construct();
  4.         $this->load->library('curl');
  5.     }
  6.    
  7.     public function index() {      
  8.         $this->load->view('npp_v');
  9.     }
  10.  
  11.     public function ceknpp() {     
  12.         $NPP = trim($this->input->post('npp', 'true'));    
  13.         $url="https://es.bpjsketenagakerjaan.go.id/cekiuran/npp/kds/bpptkds261115".'/'.$NPP;
  14.        
  15.         $curl = curl_init($url);
  16.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  17.         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
  18.         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  19.         //execute the session
  20.         $curl_response = curl_exec($curl);
  21.         //finish off the session
  22.         curl_close($curl);
  23.         $curl_jason = json_decode($curl_response, true);
  24.         //print_r($curl_jason);
  25.  
  26.         echo $curl_jason[0]['PRS'];
  27.         echo $curl_jason[0]['STATUS'];
  28.         echo $curl_jason[0]['MSG'];
  29.     }
  30.        
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement