<?php

// http://127.0.0.1/hsintungyang-energy/action/schedule/man_export_report_year.php?start_year=2023&end_year=2024
set_time_limit(0);
if(isset($_GET['start_year']) && isset($_GET['end_year']))
{
	$start_year = $_GET['start_year'];
	$end_year = $_GET['end_year'];

	for ($y=$start_year; $y <= $end_year; $y++) 
	{ 
		$path = substr($_SERVER['PHP_SELF'],1,strrpos($_SERVER['PHP_SELF'],'/'));
		$url = "http://127.0.0.1:{$_SERVER['SERVER_PORT']}/{$path}excel_export_report_year.php?report_date={$y}";
		// echo $url.'<br>';
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$res = curl_exec($ch);
		echo $y.': '.$res.'<br>';
		curl_close($ch);
		sleep(1);
	}
	
}
else
{
	echo 'no param: start_year,end_year';
}

?>
