jamboljack

Curl Dukcapil

Oct 24th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. $this->load->library('curl');
  2. header('Content-Type: application/json');
  3.         $nik    = '3320015809580001';
  4.         $post = [
  5.             'user_id'   => 'DISPERKIM',
  6.             'password'  => 'rumah',
  7.             'nik'       => $nik,
  8.         ];
  9.  
  10.         $ch = curl_init('http://222.124.25.110:8000/dukcapil/get_json/DISPERKIM/NIK'); // Link API Dukcapil
  11.         curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json'));
  12.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13.         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  14.         $curl_response = curl_exec($ch);
  15.         curl_close($ch);
  16.         $curl_jason = json_decode($curl_response, true);
  17.         print_r($curl_jason);
Add Comment
Please, Sign In to add comment