Jump to content

[PHP] Novos posts no P@P


djthyrax
 Share

Recommended Posts

Old code para ver novos posts no P@P através do feed RSS.

<?php
//header("Content-Type: text/plain");
header("Content-Type: text/html; charset=utf-8");	
include "lib/rss_php.php";

$x = new rss_php;
$x->load("http://www.portugal-a-programar.org/forum/index.php?type=rss;action=.xml;limit=10");
$y = $x->getRSS(true);

//var_dump($y['rss']['value']['channel']['value']);
echo "<table border='1'>";
echo "          <tr>
              <td align='center'>Nome do Post (Quadro)</td>
              <td align='center'>Descrição</td>
              <td align='center'>Data</td>
          </tr>";
      

$items = $y['rss']['value']['channel']['value'];
foreach($items as $k => $item){
if(substr($k, 0, 4) != "item") continue;
$item = $item["value"];
printf("          <tr>
              <td align='center'><a href='%s'>%s</a> (%s)</td>
              <td>%s</td>
              <td align='center'>%s</td>
          </tr>", $item['guid']['value'] , $item['title']['value'], $item['category']['value'], $item['description']['value'], $item['pubDate']['value']);
}

echo "</table>";

A class rss_php é esta: http://rssphp.net/

Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.