in the registration page says “To help community science and improve air quality forecasting, share your device’s location and sensor readings with The Weather Company, LLC (includes Weather Underground and The Weather Channel branded platforms).”
last two days i’m trying to send data to my own web server using php.
no good. i can see in my router the sensor opening connection to my web server.
trying to dump data with this php script
<?php
// Configure these
$log_file = 'purpleair_log.json'; // JSON log file
$debug_log = 'purpleair_debug.log'; // Human-readable log
// Get the raw JSON input
$json_input = file_get_contents('php://input');
$data = json_decode($json_input, true);
// Prepare logs
$timestamp = date('Y-m-d H:i:s');
$ip = $_SERVER['REMOTE_ADDR'];
// 1. Save raw JSON data (for machines)
file_put_contents($log_file, $json_input . "\n", FILE_APPEND);
// 2. Create human-readable debug log
$debug_entry = <<<LOG
===== [{$timestamp}] =====
IP: {$ip}
Sensor ID: {$data['SensorId']}
Location: {$data['lat']}, {$data['lon']}
PM2.5 AQI: {$data['pm2.5_aqi']}
Uptime: {$data['uptime']} seconds
RSSI: {$data['rssi']} dBm
Full Data:
LOG;
file_put_contents($debug_log, $debug_entry . print_r($data, true) . "\n\n", FILE_APPEND);
// Required response for PurpleAir
header('Content-Type: application/json');
echo json_encode(['status' => 'success', 'message' => 'Data logged']);
?>
it seems that no connection reaches the web server..
does anyone have a success story on this ?