من شاید برنامه نویسیم به اندازه شما خوب نباشه ...
کدی که من الان دارم اینه ممنون میشم راهنمایی کنید.
<html dir="rtl" xml:lang="fa">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
</head>
<body>
<?
include("class.xml.parser.php");
include("class.weather.php");
// -------------------
// LOGIC
// -------------------
// Create the new weather object!
// CIXX0020 = Location Code from weather.yahoo.com
// 3600 = seconds of cache lifetime (expires after that)
// C = Units in Celsius! (Option: F = Fahrenheit)
$timeout=3*60*60; // 3 hours
if (isset($_ENV["TEMP"]))
$cachedir=$_ENV["TEMP"];
else if (isset($_ENV["TMP"]))
$cachedir=$_ENV["TMP"];
else if (isset($_ENV["TMPDIR"]))
$cachedir=$_ENV["TMPDIR"];
else
// Default Cache Directory
$cachedir="/tmp";
$cachedir=str_replace('\\\\','/',$cachedir);
if (substr($cachedir,-1)!='/') $cachedir.='/';
$code=$_POST['citycode'];
$weather_chile = new weather($code, 3600, "C", $cachedir);
// Parse the weather object via cached
// This checks if there's an valid cache object allready. if yes
// it takes the local object data, what's much FASTER!!! if it
// is expired, it refreshes automatically from rss online!
$weather_chile->parsecached(); // => RECOMMENDED!
// allway refreshes from rss online. NOT SO FAST.
//$weather_chile->parse(); // => NOT recommended!
// -------------------
// OUTPUT
// -------------------
// VARIOUS
print "<h1>Various</h1>";
print "عنوان: ".$weather_chile->forecast['TITLE']."<br>"; // Yahoo! Weather - Santiago, CI
print "شهر: ".$weather_chile->forecast['CITY']."<br>"; // Santiago
print "طلوع آفتاب: ".$weather_chile->forecast['SUNRISE']."<br>"; // 6:49 am
print "غروب آفتاب: ".$weather_chile->forecast['SUNSET']."<br>"; // 08:05 pm
print "yahoolink: ".$weather_chile->forecast['LINK']."<br>"; // http://us.rd.yahoo.com/dailynews/rss/weather/Santiago__CI/*http://xml.weather.yahoo.com/forecast/CIXX0020_c.html
print "<hr>";
// ACTUAL SITUATION
print "<h1>Actual Situation</h1>";
//print_r($weather_chile->forecast['CURRENT']);
print "acttext: ".$weather_chile->forecast['CURRENT']['TEXT']."<br>"; // Partly Cloudy
print "acttemp: ".$weather_chile->forecast['CURRENT']['TEMP']."<br>"; // 16
print "acttime: ".$weather_chile->forecast['CURRENT']['DATE']."<br>"; // Wed, 26 Oct 2005 2:00 pm CLDT
//print "imagurl: ".$weather_chile->forecast['CURRENT']['IMAGEURL']."<br>"; // http://us.i1.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif
print "actcode: ".$weather_chile->forecast['CURRENT']['CODE']."<br>";
print "image: <img src=images/".$weather_chile->forecast['CURRENT']['CODE'].".png>";
print "<hr>";
// Forecast
for ($day=0; isset($weather_chile->forecast[$day]); $day++) {
print "<h1>Forecast Day $day</h1>";
//print_r($weather_chile->forecast[$day]);
print "امروز: ".$weather_chile->forecast[$day]['DAY']."<br>"; // Wed
print "تاریخ: ".$weather_chile->forecast[$day]['DATE']."<br>"; // 26 Oct 2005
print "<img src=images/d.gif> ".round(($weather_chile->forecast[$day]['LOW']-32)/1.8)." "; // 8
print "<img src=images/u.gif> ".round(($weather_chile->forecast[$day]['HIGH']-32)/1.8)."<br>"; // 19
print "وضعیت: ".$weather_chile->forecast[$day]['TEXT']."<br>"; // Partly Cloudy
print "کد: ".$weather_chile->forecast[$day]['CODE']."<br>"; // 29=Image for partly cloudy
print "عکس: <img src=images/".$weather_chile->forecast[$day]['CODE'].".png>";
print "<hr>";
}
?>
<select name="citycode">
<option value="IRXX0019">yazd</option>
<option value="IRXX0018">tehran</option>
</select>
</params>
</body>
</html>