Files
BE_IBL/application/controllers/satu_sehat_x/Ssapi.php
2026-04-15 15:23:57 +07:00

50 lines
1.3 KiB
PHP

<?php
class Ssapi extends MY_Controller {
function __construct() {
parent::__construct();
$this->load->library("Satusehat");
}
function test_auth() {
// $this->load->library("Satusehat");
$result = $this->get_new_token();
echo json_encode($result);
}
function test_gettoken() {
//$this->load->library("Satusehat");
$result = $this->satusehat->get_token();
echo $result;
}
function get_new_token(){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-satusehat-dev.dto.kemkes.go.id/oauth2/v1/accesstoken?grant_type=client_credentials',
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 => 'client_id=6PukKqO0RQqu0cKBOC8EKGcXQySfPR4aVkiVmuTgkx5xvva4&client_secret=89ZqsmY3z5W7rVscHTp9gJoAWWiAZG4A2unS3maTw3DxBFxTdaRsSeTUbD8mRN3p',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
function get_service_request(){
$uuid =
}
}