Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function cek_data_pbb()
- {
- $nop_asli = trim(stripHTMLtags($this->input->post('nop_pbb', 'true')));
- $nop = str_replace('.', '', $nop_asli);
- $curl = curl_init();
- $dataPost = array('NOP' => $nop);
- curl_setopt_array($curl, array(
- CURLOPT_URL => "https://simbphtb.kuduskab.go.id/simbphtb/h2h_bpn_kudus/Api/getPBBServiceJamak",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => "",
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => "GET",
- CURLOPT_POSTFIELDS => json_encode($dataPost),
- CURLOPT_HTTPHEADER => array(
- "Content-Type: application/json",
- "Cookie: h2hbpnbphtb=7psu72g6a12elj6tvkf2594qn4",
- ),
- ));
- $response = curl_exec($curl);
- $err = curl_error($curl);
- curl_close($curl);
- if ($err) {
- $callback = array('status' => 'errorAPI');
- } else {
- $obj = json_decode($response, true);
- $jml = count($obj['ITEM']);
- if ($jml > 0) {
- $callback = array(
- 'status' => 'success',
- 'nop' => $nop_asli,
- 'nama' => $obj['NAMA_WP'],
- 'alamat' => $obj['ALAMAT_OP'] . ' ' . $obj['KELURAHAN_OP'] . ' KEC. ' . $obj['KECAMATAN_OP'],
- 'kota' => $obj['KOTA_OP'],
- 'luastanah' => number_format($obj['LUASTANAH_OP'], 0, '', ','),
- 'luasbangun' => number_format($obj['LUASBANGUNAN_OP'], 0, '', ','),
- 'njop_tanah' => number_format($obj['NJOP_TANAH_OP'], 0, '', ','),
- 'njop_bangunan' => number_format($obj['NJOP_BANGUNAN_OP'], 0, '', ','),
- 'item' => $obj['ITEM'],
- );
- } else {
- $callback = array('status' => 'notfound');
- }
- }
- echo json_encode($callback);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement