laptopu Posted January 25, 2013 Share Posted January 25, 2013 Hello, I am wondering if someone can help me sanitize an RSS feed I am parsing please? I am not really a good coder I will admit so any help is appreciated. I am trying to display an RSS feed on an IP handset which displays plain text. Using a weather feed there is a degree symbol in the feed which shows up as ?? on the handset. The feed I am using is here: http://open.live.bbc.co.uk/weather/feeds/en/2643743/observations.rss And here is the script I have so far: <?PHP getFeed('http://open.live.bbc.co.uk/weather/feeds/en/2643743/observations.rss'); function getFeed($feed_url) { $content = file_get_contents($feed_url); $x = new SimpleXmlElement($content); foreach($x->channel->item as $entry) { //$pgtitle = "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>"; echo "" . $entry->title . ""; echo " "; echo "" . $entry->description . ""; } } ?> I have read a lot about sanitizing tags but I have tried inserting them in lots of different ways but the degree symbol always appears. Can anyone tell me what I need to do to my code please? Thanks for your help in advance. Quote Link to comment https://forums.phpfreaks.com/topic/273646-sanitizing-help/ Share on other sites More sharing options...
laptopu Posted January 25, 2013 Author Share Posted January 25, 2013 My apologies - this was solved moments after I posted for help, a friend has just emailed me the solution which is to post this after the file_get_contents line: $content = str_replace("°", "", $content); Quote Link to comment https://forums.phpfreaks.com/topic/273646-sanitizing-help/#findComment-1408265 Share on other sites More sharing options...
kicken Posted January 25, 2013 Share Posted January 25, 2013 (edited) Sounds like all you need to do is str_replace the degree symbol either with something else (ie, maybe 'degrees') or with nothing (''). edit: no new-post notification strikes again! Edited January 25, 2013 by kicken Quote Link to comment https://forums.phpfreaks.com/topic/273646-sanitizing-help/#findComment-1408266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.