2009-11-17 76 views

回答

0

您可以阅读转化率是这样的:

<?php 

$x = simplexml_load_file('http://www.tcmb.gov.tr/kurlar/today.xml'); 

// Use GBP as an example 
$code = 'GBP'; 

$nodes = $x->xpath('//Currency[@CurrencyCode="' . $code . '"]'); 

echo 'Buying Rate for ' . $code . 'is ' . (string)$nodes[0]->BanknoteBuying; 


?> 
+0

嗯,这就是酷什么,所以我可以使$代码动态从形式提交和使用数学动作:)谢谢... – 2009-11-17 13:25:44

0
$site = file_get_contents("http://www.tcmb.gov.tr/kurlar/today.xml"); 
preg_match_all("'EURO</CurrencyName><ForexBuying>(.*)</ForexBuying><ForexSelling>(.*)<CrossRateOther>(.*)<'U", $site, $durum); 
preg_match_all("'POUND STERLING</CurrencyName><ForexBuying>(.*)</ForexSelling>(.*)<CrossRateOther>(.*)<'U", $site, $GBP); 
$tl  = $durum[1][0]; 
$dolar = $durum[3][0];