Use BNM Open API Data
- Kijang_Emas
- OPR
- kl-usd-reference-rate
Able to retrieve the body via POSTMAN but unable to retrieve by using controller.
$client = new Client();
$result = $client->get('https://api.bnm.gov.my/public/opr', [
'headers' => [
'Accept' => 'application/vnd.BNM.API.v1+json',
'Content-Type' => 'application/json',
],
]);
echo $result->getStatusCode();
echo $result->getBody();
if ($result->getStatusCode() == 200) { // 200 OK
$response_data = $result->getBody()->getContents();
}
- Main
- Kijang_Emas
- OPR
- KL-USD-Reference-Rate