<?php
$certFile = "/etc/apache2/ssl/thekohsamui/thekohsamui_com.crt";
$keyFile = "/etc/apache2/ssl/thekohsamui/thaisanakoh.com.key" ;
$headers = array(
"Content-type: application/x-www-form-urlencoded",
"Authorization: Basic RwerWkZWcGpJQ0E5Y2xScUFQZVowODhSQTVYTFgzNzk6QTNLNkxjVHU3OTZ1QTZteAxy"
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_URL,'https://openapi-test.thaisana.com/v1/qrpayment/request');
curl_setopt($curl, CURLOPT_SSLCERT, $certFile);
curl_setopt($curl, CURLOPT_SSLKEY, $keyFile);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($curl);
echo $result ;
if (curl_errno($curl)) {
echo 'Error:' . curl_error($curl);
}
curl_close($curl);
?>
Open in new window
curl --cert /etc/apache2/ssl/thekohsamui/thekohsamui_com.crt \
--key /etc/apache2/ssl/thekohsamui/thaisanakoh.com.key \
--location --request POST 'https://openapi-test.thaisana.com/v2/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic RwerWkZWcGpJQ0E5Y2xScUFQZVowODhSQTVYTFgzNzk6QTNLNkxjVHU3OTZ1QTZteAxy' \
--data-urlencode 'grant_type=client_credentials'
This is result
{"token_type":"Bearer","client_id":"xyzZFVpjICA9clRqAPeZ088RwRTLX379","access_token":"xyzrhBVp4E54gASCo0DzpvW0sUR8","scop e":"","expires_in":"1799","status":"approved"}