我想从定期更新它们的网站中提取特定货币的值。因为我只需将欧元兑换成少数外币。这可能或者我应该创建自己的数据库并进行更新吗?
答案 0 :(得分: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];
}
}
我希望这会对你有所帮助:)。