0

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

4

1 回答 1

2

通过调用这个 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];
      }    
  }

我希望这能帮到您 :)

于 2013-05-18T15:22:16.547 回答