Jump to content

PHP, XML and Magpie


james13009

Recommended Posts

Im using the above technologies to read feeds, i just need some help with my php coding, this is what i have that works, it reads the first 5 items in an xml feed:

 

<?php
include('../../Rss/chart2Rss/rss_fetch.inc');// Set error reporting for this
error_reporting(E_ERROR);// Fetch RSS feed
$rss = fetch_rss('http://www.nationalspares.co.uk/XML/rss3.xml');
if ($rss)
{
// Split the array to show first 5
$items = array_slice($rss->items, 0, 5);
// Cycle through each item and echo
foreach ($items as $item ) 
{
echo '<li><a href="'.$item['link'].'">'.$item['title'].'</a> - '.$item['author'].'</li>';



}}else {  echo '<h2>Error:</h2><p>'.magpie_error().'</p>';}// Restore original error reporting value@ini_restore('error_reporting');


?>

 

But what i really want it to do is to only select items within the feed with certain content,

 

for example only select the items which have the category as "Hits" , in the feed here:

 

http://www.nationalspares.co.uk/XML/rss3.xml

 

So what im looking for is a 'where' statement, any help appreciated

 

Thanks in advance James

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.