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. 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); 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 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! Link to comment https://forums.phpfreaks.com/topic/273646-sanitizing-help/#findComment-1408266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.