Hellow fellow coders, I am stuck trying to display rss feeds from my site forum ( vbulletin powerd ) Bellow is s snippet of the code for where i want it to be displayed. The feeds are being displayed at http://www.united-gamerz.com/forum/external.php What i want is the recent 5 threads to be displayed in the <li> tags e.g. <li>Recent post 1 title linked to post</li> PHP: <div id="box7"> <h2 class="text2 title2">Recent</h2> <div class="content"> <div class="box"> <h3 class="text2">Recent threads on the forum</h3> <ul class="ul2"> <li>recent thread - waiting for rss feed</li> <li>recent thread - waiting for rss feed</li> <li>recent thread - waiting for rss feed</li> <li>recent thread - waiting for rss feed</li> <li>recent thread - waiting for rss feed</li> </ul> </div> PHP: Can anyone help and tell me what to do? Thanks Paul
Here you go! You didn't need no big libraries, just some basic PREG. <?PHP $Data=file_get_contents('http://www.united-gamerz.com/forum/external.php'); preg_match_all('/\<title\>(.*?)\<\/title\>/',$Data,$Titles); preg_match_all('/\<link\>(.*?)\<\/link\>/',$Data,$Links); $Titles=array_slice($Titles[1],2); //First 2 are the forum's stuff $Links=array_slice($Links[1],2);// Skip two $URLs=array(); for($i=0;$i<count($Titles);$i++) $URLs[$Titles[$i]]=$Links[$i]; // Make a new array! ?> <div id="box7"> <h2 class="text2 title2">Recent</h2> <div class="content"> <div class="box"> <h3 class="text2">Recent threads on the forum</h3> <ul class="ul2"> <?PHP foreach($URLs as $Title => $Link) echo '<li><a href="'.$Link.'">'.$Title.'</a></li>'; ?> </ul> </div> PHP: