22 lines
838 B
PHP
22 lines
838 B
PHP
<?php
|
|
// Fetches wildfire data from WFIGS and returns as JSON
|
|
header('Content-Type: application/json');
|
|
|
|
// The ArcGIS REST API endpoint for current wildfire perimeters
|
|
$url = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters_Current/FeatureServer/0/query?where=1=1&outFields=poly_IncidentName,poly_Acres_AutoCalc,attr_InitialResponseDateTime,attr_PercentContained&f=geojson';
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_USERAGENT, 'worldsphere.ai bot'); // Some APIs require a user agent
|
|
$response = curl_exec($ch);
|
|
curl_close($ch);
|
|
|
|
if ($response === false) {
|
|
echo json_encode(['error' => 'Could not fetch wildfire data.']);
|
|
exit;
|
|
}
|
|
|
|
// Directly pass through the GeoJSON response
|
|
echo $response;
|
|
?>
|