Hello I have an RSS script and everytime it gets parsed and there is a character in there such as < or " I keep getting errors and its showing up as the html version instead of Ansii here is the sample of the error: This page contains the following errors: error on line 10 at column 121: Extra content at the end of the document Below is a rendering of the page up to the first error. <title>Êà ê âçëîìà òü ïà ðîëü Ãà îäÃîêëà ññÃèêà õ Coupon Codes - Êà ê âçëîìà òü ïà ðîëü Ãà îäÃîêëà ññÃèêà õ Offer Codes and Discounts</title> <pubDate> 2011-06-10 20:51:14</pubDate> <description>women dating younger men, &lt;a href=&quot;http://gasulfupe.e.gp/jys_ramu.html&quot;&gt;öåÃòð îáóâü&lt;/a&gt;, 724, &lt;a href=&quot;http://absacseis...</description> <link>http://coupo.org/http://keymetosep.info.cm/sep_lox.html/ </link> as you can see the title is garbled and this is also the same listing that I am getting the above error on. All I would like to do is replace characters in this feed with characters that I want them to be replaced with. The first person who gives me the answer will be paid. Please do not fight with me fellas I am only awarding one person and thats only if his idea works... Also anyone looking for freelance, I am looking for freelance PHP workers. If you apply I will provide you with a simple task and if you can perform it in a timely fashion I will have plenty of work to keep your workload full.
This is confusing and without seeing the RSS script my solution for replacing your characters would be adding the following line: $bad_character = '<'; $good_character = '<' $rss_feed = file_get_contents('http://feeds.feedburner.com/coupo/'); $rss_feed_clean = str_replace($bad_character, $good_character, $rss_feed); echo $rss_feed_clean; PHP: You can set up an array of good and bad characters to look for and then instead of simply echoing the clean file, have it write it (or publish it with Feedburner).
i think this is what you need.. hope it helps coz i spent some time typing it <? //declare an array of characters you want to replace $findme[0] = '&lt;'; $findme[1] = '&quot;'; $findme[2] = '&gt;'; //remember the no. of characters/strings you are replacing.. in this case it is 3 $count = 3; //or you can also use following : Just uncomment it to use it. //$count = count($findme); //declare similar replace character/string array corresponding to $findme array $replacewith[0] = '<'; $replacewith[1] = '"'; //double quote inside single quotes $replacewith[2] = '>'; //now replace these characters in the feed $myfeed = file_get_contents('http://feeds.feedburner.com/coupo/'); for($i=0;$i<$count;$i++) { $myfeed = str_replace($findme[$i],$replacewith[$i],$myfeed); } echo $myfeed; //this feed is as u want it to be ?> PHP: Edit : You asked for replacing thing so i gave you this method! but if you just have problem with &lt; etc.. then i guess you can use the default php function html_entity_decode () for e.g. $myfeed = file_get_contents('http://feeds.feedburner.com/coupo/'); $myfeed = html_entity_decode ($myfeed); echo $myfeed; PHP:
No error in this code. It runs fine, at least on my server. But are you sure you have right strings in $findme array. because html code for <, " and > are <, "e; and >. Not &lt;, &quote; and &gt;
ya i know that, but i have coded it as per what i thought was topic opener's need He said it gives the output in such a way so merely by seeing the code i can guess that his script is converting '<' ==> '<' ==> '&lt;' and similarly for other special characters so i suggested the above code...
sorry guys I didnt respond sooner. I found the problem. Someone was adding spam to my RSS and that was the problem. I now made it so that I have to approve the content before adding... dumb noob mistake.