【问题标题】:Pulling currency values from other websites [closed]从其他网站提取货币价值[关闭]
【发布时间】:2013-05-18 14:58:19
【问题描述】:

我想从定期更新的网站中提取特定货币的价值。因为我只需要将欧元兑换成几种外币。这可能吗,还是我应该创建自己的数据库并更新它?

【问题讨论】:

    标签: php currency


    【解决方案1】:

    通过调用这个 xml http://themoneyconverter.com/rss-feed/EUR/rss.xml

    $url = "http://themoneyconverter.com/rss-feed/EUR/rss.xml";
                $cont = file_get_contents($url);
                 $xml = new SimpleXMLElement($cont);
    $feeds = "AED/EUR"; //// currency rate for United Arab Emirates Dirham
                       ///// You can use it as session
            foreach ($xml->channel->item as $xml2){
                if ($xml2->title==$feeds){
                $xml2->description."<br>";
                preg_match('/([0-9]+\.[0-9]+)/', $xml2->description, $matches);
                $rate = $matches[0];
          }    
      }
    

    希望对你有帮助:)

    【讨论】:

    • 谢谢,我去看看
    猜你喜欢
    • 2015-11-15
    • 1970-01-01
    • 2018-01-14
    • 1970-01-01
    • 2019-10-04
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多