URL API: http://api.vieit.net/ncov/{CountryName} (để trống {CountryName} mặc định là World)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.vieit.net/ncov/Vietnam",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Dữ liệu JSON trả về: {"country":"Vietnam","totalCases":241,"newCases":1,"totalDeaths":0,"activeCases":151,"totalRecovered":90,"criticalCases":3}
Các Country được hỗ trợ:
- World
- USA
- China
- UK
- Canada
- Korea
- Australia
- Malaysia
- India
- Philippines
- Japan
- Indonesia
- Thailand
- Singapore
- HongKong
- Vietnam
Cảm ơn đã đọc, mình sẽ update thêm các Country khác để mọi người tham khảo (nhớ nhập đúng format của tên Country mình liệt kê bên trên)