hanze/iwa-panda2

Controller/hdata/hdata.php in datatowebsite
Repositories | Summary | Log | Files | README.md

hdata.php (915B) download


 1<?php
 2function make_table() {
 3    $key = new Key();
 4    if (isset($_GET['downloadXml'])) {
 5        $filename = 'weather_data.xml'; // Specify the filename for the downloaded XML file
 6
 7        // Set the appropriate headers for file download
 8        header('Content-Type: application/xml');
 9        header('Content-Disposition: attachment; filename="' . $filename . '"');
10
11        // Retrieve the XML data
12        $humidityXml = $key->retrieveHumidityTable('ae9c50dc5cd58c538a0d6aedb17fffedcaffd568d22381dab3ae72baaeb24684', true);
13        $hDataXml = $key->retrieveHData('ae9c50dc5cd58c538a0d6aedb17fffedcaffd568d22381dab3ae72baaeb24684', true);
14
15        // Output the XML data directly to the browser
16        echo '<weather>' . $humidityXml . $hDataXml . '</weather>';
17
18        exit();
19    } else {
20        return $key->retrieveHData('3jvl/yb?sRr80s6lTdeOyxV9VTQZkCPRp/bKOWKFWxfL2vhsU4Hhpgcmz9qe0zEk');
21    }
22}
23?>