Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config.php";
- // Do query's
- mysqli_query($con, "SET CHARACTER SET utf8");
- mysqli_query($con, "SET NAMES 'utf8'");
- $query = mysqli_query($con, "SELECT
- kodekelas,
- koderuang
- FROM bed_available_bpjs");
- // Start of loop process
- while($row = mysqli_fetch_assoc($query))
- {
- // create record to JSON
- $data = json_encode($row);
- // Computes the timestamp
- date_default_timezone_set('UTC');
- $tStamp = strval(time()-strtotime('1970-01-01 00:00:00'));
- // Computes the signature by hashing the salt with the secret key as the key
- $signature = hash_hmac('sha256', $consid."&".$tStamp, $secretKey, true);
- // base64 encode…
- $encodedSignature = base64_encode($signature);
- $ch = curl_init();
- $headers = array(
- 'X-cons-id: '.$consid .'',
- 'X-timestamp: '.$tStamp.'' ,
- 'X-signature: '.$encodedSignature.'',
- 'Content-Type: Application/JSON',
- 'Accept: Application/JSON'
- );
- /**
- Sending record to API Aplicares (for DELETE)
- */
- curl_setopt($ch, CURLOPT_URL, "http://dvlp.bpjs-kesehatan.go.id:8888/aplicaresws/rest/bed/delete/{YOUR PPK CODE}");
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $content = curl_exec($ch);
- $err = curl_error($ch);
- print_r($err);
- print_r($content);
- // close cURL resource, and free up system resources
- curl_close($ch);
- }
- // End of loop process
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement