//1. read the PM + json file contents in php
$jsondatapm = file_get_contents(‘https://data.sensor.community/airrohr/v1/sensor/52812/’);
$jsondatathp = file_get_contents(‘https://data.sensor.community/airrohr/v1/sensor/52813/’);

//2. convert json object to php associative array
$datapm = json_decode($jsondatapm, true);
$datathp = json_decode($jsondatathp, true);

//show json data content

//echo $datapm[0][‘sensordatavalues’][0][‘value’]; //PM10
//echo $datapm[0][‘sensordatavalues’][1][‘value’]; //PM2.5

//echo $datathp[0][‘sensordatavalues’][0][‘value’]; //Temp
//echo $datathp[0][‘sensordatavalues’][1][‘value’]; //Humidity

echo ‘

‘;

echo ‘

Timestamp Monitor
ID
PM10
[µg/m³]
PM2.5
[µg/m³]
Temperature
[°C]
Pressure
[hPa]
Humidity
[%]
‘ . $datapm[0][’timestamp’] . ‘ ‘ . $datapm[0][‘sensor’][‘id’] . ‘ ‘ . round($datapm[0][‘sensordatavalues’][0][‘value’],0) . ‘ ‘ . round($datapm[0][‘sensordatavalues’][1][‘value’],0) . ‘ ‘ . round($datathp[0][‘sensordatavalues’][0][‘value’],1) . ‘ ‘ . round(($datathp[0][‘sensordatavalues’][2][‘value’]/100),2) . ‘ ‘ . round($datathp[0][‘sensordatavalues’][1][‘value’],1) . ‘