Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function cek_data_bphtb()
- {
- $nop = trim(stripHTMLtags($this->input->post('nop_bphtb', 'true')));
- $ntpd = trim(stripHTMLtags($this->input->post('ntpd', 'true')));
- $dataPost = array('USERNAME' => 'bpn3kabkudus', 'PASSWORD' => 'admin', 'NOP' => $nop, 'NTPD' => $ntpd);
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => "https://simbphtb.kuduskab.go.id/simbphtb/h2h_bpn_kudus/Api/getBPHTBService",
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => "",
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => "POST",
- CURLOPT_POSTFIELDS => http_build_query($dataPost),
- ));
- $response = curl_exec($curl);
- $err = curl_error($curl);
- curl_close($curl);
- if ($err) {
- $callback = array('status' => 'errorAPI');
- } else {
- $obj = json_decode($response, true);
- $code = $obj['respon_code'];
- if ($code == 'OK') {
- $callback = array(
- 'status' => 'success',
- 'nop' => $obj['result']['NOP'],
- 'ntpd' => $obj['result']['NTPD'],
- 'nama' => $obj['result']['NAMA'],
- 'alamat' => $obj['result']['ALAMAT'] . ' ' . $obj['result']['KELURAHAN_OP'] . ' KEC. ' . $obj['result']['KECAMATAN_OP'],
- 'kota' => $obj['result']['KOTA_OP'],
- 'luastanah' => number_format($obj['result']['LUASTANAH'], 0, '', ','),
- 'luasbangun' => number_format($obj['result']['LUASBANGUNAN'], 0, '', ','),
- 'bayar' => number_format($obj['result']['PEMBAYARAN'], 0, '', ','),
- 'tanggalbayar' => $obj['result']['TANGGAL_PEMBAYARAN'],
- );
- } else {
- $callback = array('status' => 'notfound');
- }
- }
- echo json_encode($callback);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement