...

View Full Version : Atom RSS feeds: How do i pull out specific content?



LJackson
12-05-2008, 02:33 PM
Hi All,

i am having trouble displaying certain parts of this atom rss feed

http://ax.itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/topsongs/sf=143444/limit=10/rss.xml?partnerId=2003&TD_PARAM=http%3A%2F%2Fclkuk.tradedoubler.com%2Fclick%3Fp%3D23708%26a%3D1515427%26url%3D

i am using magpierss to parse the feed and i am then using php to manipulate the feed to "display it as i want"

i have managed to get the feed to display as it originally is

by using

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
define("MAGPIE_INPUT_ENCODING", "UTF-8");
define("MAGPIE_OUTPUT_ENCODING", "UTF-8");
define("MAGPIE_CACHE_DIR", "./magpierss/cache");
define("MAGPIE_CACHE_ON", 1);
define("MAGPIE_CACHE_AGE", 3600);
include_once("./magpierss/rss_fetch.inc");


$rss = fetch_rss("http://ax.itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/topsongs/sf=143444/limit=10/rss.xml?partnerId=2003&TD_PARAM=http%3A%2F%2Fclkuk.tradedoubler.com%2Fclick%3Fp%3D23708%26a%3D1515427%26url%3D");
$loop_count = 0;
for ($r = 0; $r <= $loop_count; $r++) {
foreach ($rss->items as $item){
if ($r <= $loop_count){
$content = $item['atom_content'];
print $content;
$r++;
}
}
}
?>
</body>
</html>

and that returns this (http://www.kernow-connect.com/affiliate/rsstest.php)(top one)

as you can see the copyright info is way to long and the font size i want reducing:

but i cannot figure out how to print out the other information seperatly like the image/image link, album info/price artist etc

i have tried to so the same as above using

$title = $item['title'];
$link = $item['link'];
$pubdate = $item['category'];
$artist = $item['coverart'];

$content = $item['atom_content'];
print "<a href=$link>$title</a><br>";
print $pubdate;
print $artist;

and only the title and link work, as its an atom rss feed do i need to do something else to get the rest of the info to display?

many thanks
Luke

LJackson
12-05-2008, 02:36 PM
here is the code from the magpierss parser for the current item

O:9:"MagpieRSS":22:{s:6:"parser";i:0;s:12:"current_item";a:0:{}s:5:"items";a:10:{i:0;a:10:{s:5:"title";s:20:"1. Run - Leona Lewis";s:4:"link";s:204:"http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fi%3D295671640%26id%3 D295671619%26s%3D143444%26partnerId%3D2003&v0=9990";s:11:"description";s:38:"Run by Leona Lewis from the album [?]
";s:7:"pubdate";s:29:"Thu 04 Dec 2008 11:45:33 -800";s:7:"content";a:1:{s:7:"encoded";s:2035:"<TABLE BORDER=0 WIDTH="100%"><TR><TD><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td ALIGN=CENTER WIDTH=166 VALIGN=TOP><a href="http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fid%3D295671619%26s%3 D143444%26partnerId%3D2003&v0=9990"><img border="0" src="http://a1.phobos.apple.com/us/r1000/050/Music/7c/7a/d5/mzi.lodmcebu.100x100-75.jpg"></a></td>
<td width="10"><img alt="" width="10" height="1" src="/images/spacer.gif"></td>
<td width="95%"><B><a href="http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fid%3D295671619%26s%3 D143444%26partnerId%3D2003&v0=9990">Spirit (The Deluxe Edition)</a></B><br>
<a href="http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewArtist%3Fid%3D208651273%26pa rtnerId%3D2003&v0=9990">Leona Lewis</a><br><br>
<font size="3" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>Release Date:</B>
14 November 2008<br>
</font><font size="3" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>Total Songs:</B>
23</font><br>
<font size="3" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>Genre:</B>
<a href="http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewGenre%3Fid%3D14%26partnerId% 3D2003&v0=9990">Pop</a></font><br>
<font size="3" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>Album Price:</B>
6.99</font><br>
<font size="3" FACE="Helvetica,Arial,Geneva,Swiss,SunSans-Regular"><B>Copyright</B>
Track 14, 23 (P) 2006; Track 1, 2, 5-12, 18, 19 (P) 2007; Track 3, 4, 13, 15-17, 20-22 (P) 2008 Simco Limited exclusively licensed to Sony BMG Music Entertainment (UK) Limited</font></td>
</tr>
</table></TD></TR>
</TABLE>
";}s:8:"category";s:3:"Pop";s:4:"itms";a:11:{s:6:"artist";s:11:"Leona Lewis";s:10:"artistlink";s:176:"http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewArtist%3Fid%3D208651273%26pa rtnerId%3D2003&v0=9990";s:5:"album";s:27:"Spirit (The Deluxe Edition)";s:9:"albumlink";s:188:"http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fid%3D295671619%26s%3 D143444%26partnerId%3D2003&v0=9990";s:10:"albumprice";s:6:"6.99";s:8:"coverart";s:242:"http://a1.phobos.apple.com/us/r1000/050/Music/7c/7a/d5/mzi.lodmcebu.53x53-50.jpghttp://a1.phobos.apple.com/us/r1000/050/Music/7c/7a/d5/mzi.lodmcebu.60x60-50.jpghttp://a1.phobos.apple.com/us/r1000/050/Music/7c/7a/d5/mzi.lodmcebu.100x100-75.jpg";s:4:"song";s:3:"Run";s:8:"songlink";s:204:"http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fi%3D295671640%26id%3 D295671619%26s%3D143444%26partnerId%3D2003&v0=9990";s:4:"rank";s:1:"1";s:6:"rights";s:175:"Track 14, 23 (P) 2006; Track 1, 2, 5-12, 18, 19 (P) 2007; Track 3, 4, 13, 15-17, 20-22 (P) 2008 Simco Limited exclusively licensed to Sony BMG Music Entertainment (UK) Limited";s:11:"releasedate";s:16:"14 November 2008";}s:7:"summary";s:38:"Run by Leona Lewis from the album [?]
";s:12:"atom_content";s:2035:"<TABLE BORDER=0 WIDTH="100%"><TR><TD><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td ALIGN=CENTER WIDTH=166 VALIGN=TOP><a href="http://clkuk.tradedoubler.com/click?p=23708&a=1515427&url=http%3A%2F%2Fitunes.apple.com%2FWebObjects%2FMZStore.woa%2Fwa%2FviewAlbum%3Fid%3D295671619%26s%3 D143444%26partnerId%3D2003&v0=9990"><img border="0" src="http://a1.phobos.apple.com/us/r1000/050/Music/7c/7a/d5/mzi.lodmcebu.100x100-75.jpg"></a></td>
<td width="10"><img alt=""

hope this helps :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum