- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Is there a way you can grab specific data from an RSS feed (XML) and output that specific data?
What I’d like to do is grab the latest article in my list (there will be multiples) and output specific information. Such as the article title and URL.
Damn. Let me google this first in case I can answer my own question.
you will handle this on the client or server?
i find it always more readable having the data in json format.
xml to json with php http://stackoverflow.com/questions/8830599/php-convert-xml-to-json
xml to json with javascript http://davidwalsh.name/convert-xml-json
SimplePie can parse the XML data. http://simplepie.org/
Thanks @pixelgrid. Just caught that post as well. PHP is what I’m looking for.
Also, thanks @AlenAbdula. I’d rather not download anything for something this simple. It does look quite useful, though.
Solved.
http://site.com/feed”);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
var_dump ($array);
?>
Okay. So, how could I output the content in the last array?
lets say your array of data is named $data
so item is
$item = $data;
foreach($item as $key=>$value){
//handle title,link etc.
}
> lets say your array of data is named $data – @pixelgrid
What do you mean by this?
Nevermind, I understand now. Thanks @pixelgrid.