2
I’m taking the RSS content from a site with the following code:
<?php
$rss = new DOMDocument();
$rss->load('https://jovemnerd.com.br/nerdnews/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(' & ', ' & ', $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>'.$date.'</em></small></p>';
echo '<p>'.$description.'</p>';
}?>
What happens, is that the date of the content is and English, how do I change to Portuguese? The variable that captures the date is the $date.
I did what you said, but it’s still the same. http://strangerthings.com.br/test/
– Felipe Viero Goulart
Felipe, here it worked right, both on the local server, as on an external one: http://phpfiddle.org/main/code/79fd-931x. It may be that some configuration is missing in your php. has a look at this thread: http://stackoverflow.com/questions/10909911/php-setlocale-has-no-effect
– Luiz Felipe Weber
It was the server yes.
– Felipe Viero Goulart