-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.php
39 lines (28 loc) · 863 Bytes
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use Curl\Curl;
require 'vendor/autoload.php';
$response = [];
$curl = new Curl();
$curl->get('https://maps.vnpost.vn/apps/covid19/api/patientapi/list');
foreach ($curl->response->data as $data) {
$response['vn'][] = [
'name' => $data->name,
'address' => $data->address,
'group' => $data->patientGroup,
'lat' => $data->lat,
'lng' => $data->lng,
];
}
$curl->reset();
$curl->setHeader('X-Access-Token', '5cf9dfd5-3449-485e-b5ae-70a60e997864');
$curl->get('https://api.covid19api.com/summary');
foreach ($curl->response->Countries as $data) {
$response['global'][] = [
'country' => $data->Country,
'total' => $data->TotalConfirmed,
'recovered' => $data->TotalRecovered,
'deaths' => $data->TotalDeaths,
];
}
$curl->close();
echo json_encode($response);