qwertyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbnmqw ertyuiopasdfghjklzxcvbnmqwer tyuiopasdfghjklzxcvbnmqwerty RSS uiopasdfghjklzxcvbnmqwertyui POR: Juárez Carrasco Erwin Guillermo Pérez Miranda Samanta opasdfghjklzxcvbnmqwertyuiop asdfghjklzxcvbnmqwertyuiopas dfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjkl zxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcv bnmqwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnmq wertyuiopasdfghjklzxcvbnmqw
C贸digo index <html> <head> <title>RSS </title> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script><!--linea para ajax--> <script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script> </head> <body> <form action="index.php" method="POST" name="frmdo" id='frmdo' ctype="multipart/formdata"> <table align='left'> <tr> <td><br><b>Seleccione una URL:</b></td> </tr> <tr> <td><select name='url' id='url' style='width:210px;'>"; //sucursales <option value="http://sports.espn.go.com/espn/rss/news">http://sports.espn.go.com/espn/rss/news< /option> <option value="http://www.eluniversal.com.mx/rss/edomex.xml">http://www.eluniversal.com.mx/rss /edomex.xml</option> </select> </td> </tr> <td><input name="Buscar" type="submit" value="Buscar"> <tr> </tr> </table> </form><br><br><br><br> <div id="ajax">&nbsp;</div> <script type="text/javascript"> $(function (e) { $('#frmdo').submit(function (e) { e.preventDefault() $('#ajax').load('mostrar.php?' + $('#frmdo').serialize()) }) }) </script> </body> </html>
</td>
Resultado <html> <head> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script> </head> <body> <?php $url=$_REQUEST['url']; $rss = simplexml_load_file($url); if($rss){ echo '<h1>'.$rss->channel->title.'</h1>'; echo '<li>'.$rss->channel->pubDate.'</li>'; $items = $rss->channel->item; $image = $rss->channel->image->url; echo '<img src='.$image.'>'; foreach($items as $item){ $title = $item->title; $link = $item->link; $published_on = $item->pubDate; $description = $item->description; $image = $item->image; echo"<table border='3'> <tr> <td colspan='2' bgcolor='darkgray' align='center'><h2><a href=''.$link.''>'.$title.'</a></h3>'</td> </tr> <tr> <td bgcolor='brown'><span>('.$published_on.')</span>'</td> <td><p>'.$description.'</p>'</td> </tr> <tr> <td></td> </tr> <table> <br>"; } } ?> </body> </html>
Ejecuciones