bangnaga

Uji Coba Bridging BPJS

Dec 8th, 2019
1,443
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $uri="https://dvlp.bpjs-kesehatan.go.id:9081/pcare-rest-v3.0/peserta/0002301576276"; //url web service bpjs
  3.     $consID     = "17551"; //customer ID anda
  4.     $secretKey  = "7aM25C258D"; //secretKey anda
  5.    
  6.     $pcareUname = "usernamepcare"; //username pcare (Dapatnya darimana ?)
  7.     $pcarePWD   = "passwordpcare"; //password pcare anda (Dapatnya darimana ?)
  8.     $kdAplikasi = "03390001"; //kode aplikasi
  9.    
  10.     $stamp      = time();
  11.     $data       = $consID.'&'.$stamp;
  12.    
  13.     $signature = hash_hmac('sha256', $data, $secretKey, true);
  14.     $encodedSignature = base64_encode($signature); 
  15.     $encodedAuthorization = base64_encode($pcareUname.':'.$pcarePWD.':'.$kdAplikasi);  
  16. $headers = array(
  17.             "Accept: application/json",
  18.             "X-cons-id:".$consID,
  19.             "X-timestamp: ".$stamp,
  20.             "X-signature: ".$encodedSignature,
  21.             "X-authorization: Basic " .$encodedAuthorization
  22.         );
  23.         echo ("X-cons-id:".$consID);
  24.         echo ("<br>");
  25.         echo ("X-timestamp: ".$stamp);
  26.         echo ("<br>");
  27.         echo ("X-signature: ".$encodedSignature);
  28.         echo ("<br>");
  29.         echo ('X-authorization: Basic :'. $encodedAuthorization);
  30.         echo ("<br>");
  31.        
  32. $ch = curl_init($uri);
  33. curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  34. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  36. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  37. $data = curl_exec($ch);
  38. curl_close($ch);
  39. return $data;
  40. ?>
RAW Paste Data