doushi4633 2016-01-25 05:01
浏览 24

echo Javascript函数由Php上的Simple Pie函数保存不起作用

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并
    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源
    • ¥15 安卓JNI项目使用lua上的问题
    • ¥20 RL+GNN解决人员排班问题时梯度消失