Algemeen forum ontrent de ontwikkelng, design en hosting van weergerelateerde websites (dit laatste om een beetje on topic te blijven)
Gebruikersavatar
Door pdw112
#71824
Code: Selecteer alles
<?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>';
sla deze op als loadknmi.php en laad deze als iframe met je site.
  • 1
  • 5
  • 6
  • 7
  • 8
  • 9