necesito el pronostico del tiempo de este link...
http://clima.msn.com/RSS.aspx?wealocations=wc:PAXX0005&weadegreetype=C& culture=es-US
y me dijeron ke puedo parsearlo con esta funcion en php...
necesito la condicion actual.. el dibujito del tiempo, la temperatura actual.. y el pronosctico para cinco dias...
alguien me puede explicar mas o menos como funciona... gracias..
Código PHP:
//**************************************
//
// Name: MEL :: RSS And XML Parse Functi
// on
// Description:**UPDATED** This function
// will parse your favorite XML and RSS new
// s feeds in a nice format. Only one varia
// ble to set up and easy to integrate and
// modify. Tested on several sources. Let m
// e know this has been useful. Comments an
// d suggestions are very much appreciate i
// t. **Please Vote**
// By: Melvin D. Nava
//
//This code is copyrighted and has // limited warranties.Please see http://
// www.Planet-Source-Code.com/vb/scripts/Sh
// owCode.asp?txtCodeId=1320&lngWId=8 //for details. //**************************************
//
<?php
//
// The Function
// By Melvin D. Nava
// http://mdnava.network.com.ve/
//
function parse_rss($f) {
$xmlfile = fopen($f, 'r');
if (!$xmlfile) die('cannot open the xml file');
$readfile = fread($xmlfile ,40000);
$parsefile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
echo '<font face=verdana><ul>';
for($i=1 ; $i<=$count-1 ;$i++) {
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description>",$filechunks[$i], $description);
echo str_replace('hxaxh','a',"<li><font style='font-size: 12px;'><hxaxh target=_blank href ='$links[1]'\>".utf8_decode($title[1])."</hxaxh></font>");
echo "<br><font color=gray style='font-size: 10px;'>".utf8_decode($description[1])."</font></li>";
}
// feel free to remove next notice
// is not needed by this function
echo '</ul><font style="font-size: 10px;">Better News Grabber by ';
echo str_replace('hxaxh','a','<hxaxh target=_blank href="http://mdnava.network.com.ve/">Melvin D. Nava</hxaxh></font></font></font>');
}
//
// The Example
//
echo '<h1>Star Wars News</h1>';
$xmlfeed = 'http://www.starwars.com/community/webmasters/starwars.rdf';
parse_rss($xmlfeed);
?>