Hi all
im still a newbie in php and
i am having a problem with a script im working on
i trying to read news from googles news api
but on the page display instead of a ' (Apostrophe) i get & #39; with the text output
ive tried to use str_replace to correct this but it seems it cant pickup the & #39;
Please help here is the code ive come up with below
im still a newbie in php and
i am having a problem with a script im working on
i trying to read news from googles news api
but on the page display instead of a ' (Apostrophe) i get & #39; with the text output
ive tried to use str_replace to correct this but it seems it cant pickup the & #39;
Please help here is the code ive come up with below
PHP Code:
<?php
$api = simplexml_load_string(utf8_encode(file_get_contents("http://www.google.co.za/ig/api?news")));
foreach ($api->news->news_entry as $info)
{
#$tittle = str_replace('& #39;',"'",$info->title->attributes()->data);
$tittle = $info->title->attributes()->data;
echo "<h3>".$tittle."</h3> \n";
echo $info->snippet->attributes()->data."<br> \n";
echo $info->date->attributes()->data."<br> \n";
echo $info->source->attributes()->data."<br> \n";
#echo $info->num_related->attributes()->data."<br> \n";
#echo $info->url->attributes()->data."<br> \n";
#echo $info->cluster_url->attributes()->data."<br> \n";
echo "<br> \n";
}
?>
Comment