Advertisement
jamboljack

Post Jabatan SAPK

Dec 7th, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. $data_kirim = array(
  2.             "id"                      => $dataPegawai->jabatan_pegawai_id_sapk,
  3.             "jenisJabatan"            => $dataPegawai->jabatan_id,
  4.             "unorId"                  => $dataPegawai->unor_id,
  5.             "eselonId"                => $dataPegawai->eselon_id,
  6.             "instansiId"              => 'A5EB03E21CF1F6A0E040640A040252AD',
  7.             "pnsId"                   => $dataPegawai->pns_id,
  8.             "jabatanFungsionalId"     => '',
  9.             "jabatanFungsionalUmumId" => '',
  10.             "nomorSk"                 => $dataPegawai->jabatan_pegawai_no_sk,
  11.             "tanggalSk"               => date('d-m-Y', strtotime($dataPegawai->jabatan_pegawai_tgl_sk)),
  12.             "tmtJabatan"              => date('d-m-Y', strtotime($dataPegawai->jabatan_pegawai_tmt_jabatan)),
  13.             "tmtPelantikan"           => date('d-m-Y', strtotime($dataPegawai->jabatan_pegawai_tmt_pelantikan)),
  14.             "pnsUserId"               => '',
  15.         );
  16.         $data_string = json_encode($data_kirim);
  17.         // print_r($data_string);
  18.         $token = $this->token();
  19.         $curl  = curl_init();
  20.         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  21.         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  22.         curl_setopt($curl, CURLOPT_URL, "https://wsrv.bkn.go.id/api/jabatan/save");
  23.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  24.         curl_setopt($curl, CURLOPT_HEADER, false);
  25.         curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
  26.         curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
  27.         curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  28.             "Content-Type: application/x-www-form-urlencoded",
  29.             "Authorization: Bearer $token",
  30.         ));
  31.         $response = curl_exec($curl);
  32.         echo curl_error($curl);
  33.         curl_close($curl);
  34.         print_r($response);
  35.         $rsp = json_decode($response, true);
  36.         print_r($rsp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement