forzatio Posted January 27, 2007 Share Posted January 27, 2007 Hi there I have some rss feed with wrong text in it, I need to replace the wrong text with my own good text.But that needs to be done after it is parsed fully into the php page.I have this magpie script used to parse it into the page.My problem is that I can't get the bad words replaced by the good words after the rss is parsed in the php page.[code]<?php require_once 'rss_fetch.inc';$url = 'http://rssfile.com/feed?hl=en&q=badname&output=rss';$rss = fetch_rss($url);foreach ($rss->items as $item ) { $description = $item[description]; $url = $item[link]; $title = $item[title]; echo "<a href=$url>$title</a><br><br>$description<br><br>";}echo str_replace('badname','goodname','$item[description]');?>[/code] Link to comment https://forums.phpfreaks.com/topic/35979-parse-a-rss-url-and-then-rename-text-in-its-output/ Share on other sites More sharing options...
Hypnos Posted January 27, 2007 Share Posted January 27, 2007 You're doing the change after the loop, and after the echo even. [code]<?php require_once 'rss_fetch.inc';$url = 'http://rssfile.com/feed?hl=en&q=badname&output=rss';$rss = fetch_rss($url);foreach ($rss->items as $item ) { $description = str_replace('badname','goodname',$item['description']); $url = $item[link]; $title = $item[title]; echo "<a href=$url>$title</a><br><br>$description<br><br>";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/35979-parse-a-rss-url-and-then-rename-text-in-its-output/#findComment-170637 Share on other sites More sharing options...
forzatio Posted January 27, 2007 Author Share Posted January 27, 2007 thanks a lot that worked great :o Link to comment https://forums.phpfreaks.com/topic/35979-parse-a-rss-url-and-then-rename-text-in-its-output/#findComment-170646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.