Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2006, 00:06
Avatar de chalchis
chalchis
 
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 21 años, 7 meses
Puntos: 21
script sobre el clima

hola amigos espero que me puedan a interpretar es este scritp
es sobre el clima

http://www.zend.com/codex.php?id=1257&single=1

<?php
class Weather {
var $Sunrise, $Sunset, $RAWXML, $LUpdated, $Obst, $City,

$State, $Condition, $Barometer, $BarometerStatus, $Wind,

$Gust, $Direction, $Humidity, $Visibility, $UVIndex,

$UVStatus, $Dewpoint, $IconNum;
function Weather($zip) {
$xmi=join('',file("http://xoap.weather.com/weather/local/".

$zip."?cc=*&prod=xoap&par=1003188692&key=7392ac66b 4e27671")

);
$this->RAWXML = $xmi;
$this->Sunrise = $this->in("<sunr>","</sunr>",$xmi);
$this->Sunset = $this->in("<suns>","</suns>",$xmi);
$this->LUpdated=$this->in("<lsup>","</lsup>",$xmi);
$this->Obst = $this->in("<obst>","</obst>",$xmi);
$dnaminfo = $this->in("<dnam>","</dnam>",$xmi);
if(eregi("(.*), (.*) ((.*))", $dnaminfo, $m)) {
$this->City = $m[1];
$this->State = $m[2];
}
$this->Condition=$this->in("<t>","</t>",$xmi);
$this->Temperature=$this->in("<tmp>","</tmp>",$xmi);
$barinfo = $this->in("<bar>","</bar>",$xmi);
$this->Barometer=$this->in("<r>","</r>",$barinfo);
$this->BarometerStatus=$this->in("<d>","</d>",$barinfo);
$windinfo = $this->in("<wind>","</wind>",$xmi);
$this->Wind = $this->in("<s>","</s>",$windinfo);
$this->Gust = $this->in("<gust>","</gust>",$windinfo);
$this->Direction = $this->in("<t>","</t>",$windinfo);
$this->Humidity = $this->in("<hmid>","</hmid>",$xmi)."%";
$this->Visibility = $this->in("<vis>","</vis>",$xmi);
$uvinfo = $this->in("<uv>","</uv>",$xmi);
$this->UVIndex = $this->in("<i>","</i>",$uvinfo);
$this->UVStatus = $this->in("<t>","</t>",$uvinfo);
$this->Dewpoint = $this->in("<dewp>","</dewp>",$xmi);
$this->Icon =

"http://image.weather.com/web/common/wxicons/52/".$this->in

("<icon>","</icon>", $xmi).".gif";
}
function in($One,$Two,$Three) {
$Reg = $One."(.*)".$Two;
if(eregi($Reg,$Three,$m)) {
return $m[1];
} else {
return "N/A";
}
}
}

//How to use:
$weather = new Weather("21211");
//Weather variables:
//$weather->RAWXML Raw XML data
//$weather->Sunrise Sunrise
//$weather->Sunset Sunset
//$weather->LUpdated Last Updated
//$weather->Obst Where it is reported

from
//$weather->City City of Zipcode
//$weather->State State of Zipcode
//$weather->Condition Condition (Fair or

Partly Cloudy)
//$weather->Temperature Temperature outside
//$weather->Barometer The barometer (29.87)
//$weather->BarometerStatus The barometer stat

(Falling, Steady or Rising)
//$weather->Wind The current wind in MPH
//$weather->Gust The current wind gust.

N/A if no gust.
//$weather->Direction The direction of the

wind.
//$weather->Humidity The Humidity outside

(96%)
//$weather->Visibility The visibility outside

(4.0)
//$weather->UVIndex UV Index (1)
//$weather->UVStatus UV Index Status

(Minimal)
//$weather->Dewpoint The dewpoint (36)
//$weather->Icon The Icon Number for the

Condition (52)


$weather = new Weather("21211");
echo "Baltimore Temperature: ";
echo $weather->Icon;

?>

lo que quisiera saber es como puedo utilizarlo para que me muestra el icono segun sea el caso del clima se podra

saludos

espero sus comentarios
gracias
__________________
gerardo