weather ? fejl :s
har downloadet det her scrip på http://www.gatequest.net/misc/php/msn-weather.phpmen den skriver fejl..
den ligger her
http://www.net-town.be/weather.php
hva er fejlen :S
<?php
if (!$accid) {
$accid="USHI0026";
}
$url ="http://www.msnbc.com/m/chnk/d/weather_d_src.asp?acid=$accid";
# Use cURL to get the page
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$CurlContent = curl_exec ($ch);
curl_close ($ch);
# Look for fieldnames, set into $WeatherFields array
$FieldPattern = '|this.sw([^\s]+) = |';
preg_match_all($FieldPattern, $CurlContent, $WeatherFields);
# Parse data into hash
foreach ($WeatherFields[1] as $WeatherField) {
$FieldSpec = '|this.sw' . $WeatherField . ' = "([^\"]+)|';
preg_match($FieldSpec, $CurlContent, $WeatherData);
$MsnWeather[$WeatherField] = $WeatherData[1];
}
# If the temp is N/A...
if($MsnWeather[Temp] == "N/A"){
$notavailabletemp = "1";
}
if ($MsnWeather['CIcon']=="" OR $MsnWeather['CIcon']=="NULL") {
$MsnWeather['CIcon'] = 44;
}
print "<img align=\"absmiddle\" border=\"0\" src=\"icons/". $MsnWeather['CIcon'] . ".gif\"> <a href=\"http://weather.msn.com/local.aspx?wealocations=wc:$accid\">". $MsnWeather['Temp'] ."°F</a>";
?>