Skip to content

Instantly share code, notes, and snippets.

@siteslave
Created May 26, 2021 14:33
Show Gist options
  • Save siteslave/d85ba3b9622d42980cabccf5dcc0b701 to your computer and use it in GitHub Desktop.
Save siteslave/d85ba3b9622d42980cabccf5dcc0b701 to your computer and use it in GitHub Desktop.
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cvp1.moph.go.th/api/ImmunizationHospitalSlot?Action=GetHospitalSlotByMonth&hospital_code=11053&year=2021&month=9&vaccine_plan_no=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.iH4Lie4Lii4Liy4Y"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment