Madem konu hortlamış, ben de can sıkıntısına kodları çalışır hale getirip paylaşayım dedim

<?php 
function havaDurumu($il,$sure) {  
$dosya=@fopen($il.".cache.txt", "r"); 
$data=@fread($dosya, 1024); 
$bol = explode("#", $data); 
@fclose($dosya); 
if($bol[0] < time() || !$dosya) { 
$ch = curl_init(); 
curl_setopt($ch,CURLOPT_URL,"http://www.mgm.gov.tr/tahmin/il-ve-ilceler.aspx?m=".$il); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"); 
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com.tr"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
$veri = curl_exec($ch); 
curl_close($ch); 
preg_match_all('#<td><em class="renkMax">(.*?)&#si', $veri, $cikti); 
$dosya=@fopen($il.".cache.txt", "w"); 
@fwrite($dosya,time()+60*60*$sure."#".$cikti[1][0]); 
@fclose($dosya);  
$yaz = $il." ".addslashes(trim(strip_tags($cikti[1][0])));   
} else  
$yaz = $il." ". addslashes(trim(strip_tags($bol[1])));   
return $yaz; 
}   
// --- örnek kullanım --- 
// echo havaDurumu("il adı",cache süresi); 
echo havaDurumu("Ankara",1); echo '°C<br />'; 
echo havaDurumu("istanbul",1); echo '°C<br />'; 
echo havaDurumu("izmir",1); echo '°C<br />'; 
?>