
July 8th, 2004
11:39 AM
Neverside Newbie
Status: Offline!
Syndicating XML data into a website using PHP...
Ok, let's say we have the following XML document located at www.anothersite.com/rss.xml
<rss version="2.0">
<channel>
<item1>Something</item1>
<item2>Something else</item2>
<item1>Some data</item1>
</channel>
</rss>
Now I wanna syndicate some (items 1 and 3) of that information into my own site.
I have proficient PHP skills and I know that it is possible to use PHP to display data like that on a website. Can someone tell me how to?
Using PHP I wanna turn each tag in the XML file into a variable then include that on the site. All I need to know is how to get a tag from the XML document displayed on a HTML document.
To break it down let's say I wanna have a small box on my site like:
Just some info:
- Item One: Something
- Item Three: Some data
Using the data from the XML document.
Thanks. 

July 8th, 2004
12:42 PM
Neversidian
Status: Offline!
http://www.phpfreaks.com/tutorials/44/1.php
___________________
-Developer
-Forum Leader
-NeverNET

July 8th, 2004
01:28 PM
You could take the easy way out and use ereg:
<?php
eregi("<item1 *>([^<>]*)</item1 *>",$textfilecontents,$echome);
?>
That should work, just use fopen to get the contents of the XML file.
___________________
Game servers, need one? CS, CZ, DOD danieljmccoy@hotmail.com

July 8th, 2004
04:07 PM
rally fan
Status: Offline!
You need a php rss aggregator, i used one the other week for a site i did. Basically there is a big complex class that does all the dirty work for you, and you just parse it a URL and call its functions like get title etc, then you can format it yourself. The reason i would recomend doing it this way is there are many rss variaties and syntaxes, sometimes there are even errors, so the class will either validate it or give you the correct string.
Ill try to track the link for it down now, if i dont find it just try to google for rss php aggregator
Edit: found it here http://magpierss.sourceforge.net/
Last edited by rallyrulz, July 8th, 2004 04:09 PM (Edited 1 times)