Zend - The PHP Company




Weather

Add Code


German city weather  

Type: code fragment
Added by: rovervr
Entered: 19/07/2001
Last modified: 07/12/2000
Rating: - (fewer than 3 votes)
Views: 6778
A script to display the current weather of the desired city in Germany


<?
// Author: Volker Richter [vrichter@economic-design.de]
// Date: 07-19-2001
//
// Displays today's weather of the desired german city
//
// http://www.volkerrichter.com
//

$location="Bochum";
$x=file("http://www.wetter.net/cgi-bin/wetter-net/promobox.pl?TYP=5&NAME=$location");

// join array to one string and strip html tags
$x2 strip_tags(join(" ",$x));

// cut those javascript things
$x2=str_replace("document.writeln('","",$x2);
$x2=str_replace("');","",$x2);
$x2=str_replace("-","",$x2);

// seperate fields into an array
$x=split(",",$x2);
echo 
"<b>".$x[0] . "</b><br>";
echo 
$x[1] . "<br>";
$wetta =split(" ",$x[2]);

//find end 
ereg("(.+)Wei(.*)",$x[2],$retval);

echo 
$retval[1];

?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories