this is my first attempt to ask here, hoping for your kind attention =) so here it is, I'm making a simple news aggregator site that will shows random news base on the site viewer location (COUNTRY)
. I'm using geoplugin
and javascript
to locate them and store their credentials in a variable that I will use to pass in php to generate specific NEWS
, the problem is Simple Pie is not recognizing it, here's my code
<?php
$rssLocal = "<script> document.write('http://samplenews.org/' + geoplugin_countryCode().toLowerCase() + '/rss.xml') </script>";
$rssLocalLink = "http://samplenews/ph/rss.xml";
echo $rssLocal . ' ORIG <br />';
echo $rssLocalLink;
$feed = new SimplePie($rssLocal);
$feed->set_feed_url($rssLocalLink);
$feed->enable_cache(true);
$feed->set_cache_location(storage_path().'/cache');
$feed->set_cache_duration(60*60*12);
$feed->set_output_encoding('utf-8');
$feed->init();
?>
by the way, those two echo return the same result like this
http://samplenews.org/ph/rss.xml ORIG
http://samplenews.org/ph/rss.xml