Foros del Web » Programando para Internet » PHP »

script sobre el clima

Estas en el tema de script sobre el clima en el foro de PHP en Foros del Web. 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, ...
  #1 (permalink)  
Antiguo 30/03/2006, 00:06
Avatar de chalchis  
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 20 años, 9 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
  #2 (permalink)  
Antiguo 05/06/2008, 10:43
 
Fecha de Ingreso: enero-2008
Mensajes: 2
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: script sobre el clima

con este script de weather podes poner los datos del clima en tu web

Código:
<script src='http://voap.weather.com/weather/oap/ARBA0009?
template=GENXV&
par=0&
unit=1&
key=0'
>
</script>
  #3 (permalink)  
Antiguo 05/06/2008, 10:45
Avatar de eft0  
Fecha de Ingreso: junio-2003
Ubicación: Santiago - Chile
Mensajes: 635
Antigüedad: 20 años, 10 meses
Puntos: 9
Respuesta: script sobre el clima

Solo tienes que llamar a la clase Weather->Weather($zip) donde $zip es el $zipcode de tu ciudad.
__________________
eft0's stuff! - http://estebanfernandez.net
  #4 (permalink)  
Antiguo 05/06/2008, 11:35
 
Fecha de Ingreso: enero-2008
Mensajes: 2
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: script sobre el clima

TE varios ejemplos que estan muy interesantes ya que podes cambiar el diseño y ajustarlo a tu web
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" width="500" height="500">
<tr>
<td width="100%" align="center" valign="top">
<iframe src="http://www.tutiempo.net/asociados/contenido/localizaciones.php?pais_tutiempo=AR&icao=SABE" width="500" height="500" SCROLLING="NO" HSPACE="0" VSPACE="0" FRAMEBORDER="0" MARGINHEIGHT="0">
<layer src="http://www.tutiempo.net/asociados/contenido/localizaciones.php?pais_tutiempo=AR&icao=SABE" width="500" height="500" SCROLLING="NO" HSPACE="0" VSPACE="0" FRAMEBORDER="0" MARGINHEIGHT="0">
</layer></iframe></td>
</tr>
</table>

<br />
<!-- www.tutiempo.net -->
<a href="http://www.tutiempo.net/tiempo/Buenos_Aires_Aerod/SABE.htm" target="_blank"><img border="0" src="http://www.tutiempo.net/imagenes_asociados/stb/SABE.png" width="250" height="200" alt="El Tiempo Buenos Aires Aerod."></a>
<!-- www.tutiempo.net -->
<br />
<!-- www.tutiempo.net -->
<a href="http://www.tutiempo.net/tiempo/Buenos_Aires_Aerod/SABE.htm" target="_blank"><img border="0" src="http://www.tutiempo.net/imagenes_asociados/st/SABE.png" width="250" height="80" alt="El Tiempo Buenos Aires Aerod."></a>
<!-- www.tutiempo.net -->
<br />
<script>zona="SABE"</script><script src="http://www.tutiempo.net/asociados/el_tiempo.js"></script>
<br />
<!-- www.tutiempo.net -->
<a href="http://www.tutiempo.net/tiempo/Buenos_Aires_Aerod/SABE.htm" target="_blank"><img border="0" src="http://www.tutiempo.net/imagenes_asociados/84x38/SABE.png" width="84" height="38" alt="El Tiempo Buenos Aires Aerod."></a>
<!-- www.tutiempo.net -->
<br />
<!-- www.tutiempo.net -->
<a href="http://www.silinet.com.ar" target="_blank">
<img border="0" src="http://www.tutiempo.net/imagenes_asociados/84x38/SABE.png" width="84" height="38" alt="El Tiempo Buenos Aires"></a>
<!-- www.tutiempo.net -->

<br />
<img border="0" src="http://www.tutiempo.net/imagenes_asociados/84x38/SABE.png" width="84" height="38" alt="El Tiempo Buenos Aires">



</body>
</html> 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 23:03.