- 29 jan 2020, 17:30
#71824
Code: Selecteer alles
sla deze op als loadknmi.php en laad deze als iframe met je site.<?php
if (isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) { # display source of script if requested so
$filenameReal = __FILE__;
$download_size = filesize($filenameReal);
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: text/html; charset=utf-8' );
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
header('Connection: close');
readfile($filenameReal);
exit;
}
header('Content-type: text/html; charset=iso-8859-1' );
#
# test script to display information retrieved by CURL VERSION 2 incl error and return codes
#
ini_set('display_errors', 'On'); // set all error checking on
error_reporting(E_ALL & ~E_NOTICE);
#
$frame = true; // display an iframe to test load locally
$wait = 10; // max wait time for connect
$link = 'ftp://ftp.knmi.nl/pub_weerberichten/basisverwachting.txt';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_URL, $link);
# curl_setopt ($ch,139, 80);
# curl_setopt ($ch, CURLOPT_LOCALPORT, 80);
curl_setopt ($ch, CURLOPT_FILETIME, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt ($ch, CURLOPT_TIMEOUT, $wait);
$rawData = curl_exec ($ch);
echo '<!-- Return codes:';
$info = curl_getinfo($ch);
print_r ($info);
echo ' -->'.PHP_EOL;
$errors = curl_error($ch);
curl_close ($ch);
unset ($ch);
echo '<!-- Error codes: '.$errors.' -->'.PHP_EOL;
echo '<pre>'.$rawData.'</pre>';
Weerstation Tilburg-Reeshof en Weerstation Stroe (GLD)
Fijnstofsensor (6203772) met BMP280
Fijnstofsensor (6203772) met BMP280