2009-11-17 119 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];