A
Anonymous
Guest
i wanna display weather report. to do it daily, i used to take it from a website by a sample code. but now that website changed their webpage and i cant get the weather report information from that site. how can i do this in other way? i want it to take the information from a website onload. here below the codes i was using. if you have sample codes that can do it pls write me.
Code:
$delimeters = array (
"/class=\"s\">([^\"]+)<\/font>/Ui",
"/((class=\"s\")|(class=\"s\"[ ]id=\"gray\")|(id=gray))><b>([^\"]+)<\/b><\/font>/Ui",
);
$results=array();
$city = array("Kütahya","Istanbul","Ankara");
$code = array("44","34","06");
// FMM
$citycode = array("75952","75919","75784");
// $cityname = array("%u0130zmit","%u0130stanbul","Ankara");
function hurriyetim($counter)
{
global $city,$code, $results, $new_j, $loop_i;
if ($fp = @fopen("http://www.hurriyetim.com.tr/havadurumu/sehir/1,,sid~110,00.asp?turkey=$code[$counter]","r"))
{
$buffer = "";
while (!feof($fp))
{
$buffer .= fgets($fp,4096);
}
fclose($fp);
$no = preg_match_all("/<td[ ]colspan=\"2\"[ ]WIDTH=\"130\"[ ]align=\"center\"[ ]bgcolor=#6379B5[ ]class=\"hurbeyazlink\"><b>(.*)<br>(.*)<\/b><\/td>/",$buffer,$match);
$results[$new_j][0] = $code[$counter];
$results[$new_j][1] = $match[1][0]; // day
preg_match_all("/<td[ ]height=\"30\"[ ]width=\"60\"[ ]align=\"center\"[ ]background=\/images\/acikgri\.gif><FONT[ ]color=\"red\"><b>(.*) /",$buffer,$match);
$results[$new_j][2] = $match[1][0]; //temp_high
preg_match_all("/<td[ ]rowspan=\"2\"[ ]width=\"70\"[ ]align=\"center\"[ ]background=\/images\/backimg\.gif><IMG[ ]SRC=(.*)[ ]valign=middle><\/td>/",$buffer,$match);
$new_j = 0;
$results[$new_j][4] = "http://www.hurriyetim.com.tr".$match[1][0]; //image
$j++;
}
}