Last active
February 16, 2022 10:40
-
-
Save quangpro1610/491c279c1bbc6a329dd6a68c01015fea to your computer and use it in GitHub Desktop.
API get data sumary about corona virus of Vietnam and Global
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/html; charset=utf-8'); | |
$url = 'https://code.junookyo.xyz/api/ncov-moh/data.json'; | |
$content = file_get_contents($url); | |
$json = json_decode($content, true); | |
$data = $json['data']; | |
$result = array( | |
'messages' => array( | |
'0' => array( | |
'text' => "Thế giới: \n + Số ca nhiễm: " . number_format($data['global']['cases'],0,",",".") . "\n + Tử vong: " . number_format($data['global']['deaths'],0,",",".") . "\n + Đã hồi phục: " . number_format($data['global']['recovered'],0,",",".") . "\n\nViệt Nam: \n + Số ca nhiễm: " . number_format($data['vietnam']['cases'],0,",",".") . "\n + Tử vong: " . number_format($data['vietnam']['deaths'],0,",",".") . "\n + Đã hồi phục: " .number_format($data['vietnam']['recovered'],0,",",".") | |
), | |
) | |
); | |
echo json_encode($result, JSON_UNESCAPED_UNICODE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thay vì gọi đến file json trong API url thì bạn gọi vào chatfuel trực tiếp từ file này.