php rss grabber strange characters

From: Date: Sun, 13 Apr 2014 23:17:17 +0000
Subject: php rss grabber strange characters
Groups: php.general 
Request: Send a blank email to php-general+get-323194@lists.php.net to get a copy of this message
Hello, Can someone take a look at the below code and tell me what it's problem is? What it's suppose to do is grab three news items from wordpress's rss feed. This it does. The issue is in the output I get strange characters a circumflexes I'd like to know why and if I can fix this? Here's my code: <?php $rss = new DOMDocument(); $rss->load('http://wordpress.org/news/feed/'); $feed = array(); foreach ($rss->getElementsByTagName('item') as $node) { $item = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, ); array_push($feed, $item); } $limit = 5; for($x=0;$x<$limit;$x++) { $title = str_replace(' & ', ' &amp; ', $feed[$x]['title']); $link = $feed[$x]['link']; $description = $feed[$x]['desc']; $date = date('l F d, Y', strtotime($feed[$x]['date'])); echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />'; echo '<small><em>Posted on '.$date.'</em></small></p>'; echo '<p>'.$description.'</p>'; } ?> Thanks. Dave.

« previous php.general (#323194) next »