döviz kurunu nasıl
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
bu adresten alırız ?
Örnek:
1 TL = 1.4899 USD (4 basamak ve usd satış olarak) bu şekilde.
Döviz kurunu eurobanktan nasıl alırız?
15
●1.081
- 22-08-2009, 00:35:52Kimlik doğrulama veya yönetimden onay bekliyor.
<?php /** * @author Raiden * @copyright 2009 */ $site = "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"; $xml = new SimpleXMLElement($site,NULL,TRUE); echo $xml->Cube->Cube->Cube['currency'].'-'; echo $xml->Cube->Cube->Cube['rate']; echo '<pre>'; print_r($xml); ?>
- 22-08-2009, 00:58:24Sizin verdiğinizle ekranda bu çıkıyor;
USD-1.4330 SimpleXMLElement Object ( [Cube] => SimpleXMLElement Object ( [Cube] => SimpleXMLElement Object ( [@attributes] => Array ( [time] => 2009-08-21 ) [Cube] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => USD [rate] => 1.4330 ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => JPY [rate] => 134.19 ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => BGN [rate] => 1.9558 ) ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => CZK [rate] => 25.482 ) ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => DKK [rate] => 7.4435 ) ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => EEK [rate] => 15.6466 ) ) [6] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => GBP [rate] => 0.86570 ) ) [7] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => HUF [rate] => 268.59 ) ) [8] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => LTL [rate] => 3.4528 ) ) [9] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => LVL [rate] => 0.6998 ) ) [10] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => PLN [rate] => 4.1068 ) ) [11] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => RON [rate] => 4.2240 ) ) [12] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => SEK [rate] => 10.1432 ) ) [13] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => CHF [rate] => 1.5160 ) ) [14] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => NOK [rate] => 8.5550 ) ) [15] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => HRK [rate] => 7.3083 ) ) [16] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => RUB [rate] => 45.3900 ) ) [17] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => TRY [rate] => 2.1324 ) ) [18] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => AUD [rate] => 1.7197 ) ) [19] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => BRL [rate] => 2.6289 ) ) [20] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => CAD [rate] => 1.5541 ) ) [21] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => CNY [rate] => 9.7891 ) ) [22] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => HKD [rate] => 11.1074 ) ) [23] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => IDR [rate] => 14352.49 ) ) [24] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => INR [rate] => 69.6870 ) ) [25] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => KRW [rate] => 1788.62 ) ) [26] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => MXN [rate] => 18.3954 ) ) [27] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => MYR [rate] => 5.0456 ) ) [28] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => NZD [rate] => 2.1015 ) ) [29] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => PHP [rate] => 69.378 ) ) [30] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => SGD [rate] => 2.0620 ) ) [31] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => THB [rate] => 48.765 ) ) [32] => SimpleXMLElement Object ( [@attributes] => Array ( [currency] => ZAR [rate] => 11.2261 ) ) ) ) ) )benim istediğim;
1 TL = 1.4899 USD (4 basamak ve usd satış olarak) bu şekilde. - 22-08-2009, 10:03:14Üyeliği durdurulduamaç sadece döviz kuru okumaksa kendi sitelerimde kullandigim php ve javascript servisim var
http://www.dovizxml.com/php-ile-dovi...i-okuma-sayfa/Alıntı - 22-08-2009, 16:14:32İlginiz için teşekkürler eurobank'tan almam lazım yalnız sorunum devam ediyor şöyle ki eurobankın sitesinde örnek vermiş;
<?php //This is a PHP (4/5) script example on how eurofxref-daily.xml can be parsed //Read eurofxref-daily.xml file in memory $XMLContent= file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); //the file is updated daily between 2.15 p.m. and 3.00 p.m. CET foreach ($XMLContent as $line) { if (ereg("currency='([[:alpha:]]+)'",$line,$currencyCode)) { if (ereg("rate='([[:graph:]]+)'",$line,$rate)) { //Output the value of 1 EUR for a currency code echo '1 € = '.$rate[1].' '.$currencyCode[1].'<br />'; //-------------------------------------------------- // Here you can add your code for inserting // $rate[1] and $currencyCode[1] into your database //-------------------------------------------------- } } } ?>Bu bize
1 € = 1.4330 USD 1 € = 134.19 JPY 1 € = 1.9558 BGN 1 € = 25.482 CZK 1 € = 7.4435 DKK 1 € = 15.6466 EEK 1 € = 0.86570 GBP 1 € = 268.59 HUF 1 € = 3.4528 LTL 1 € = 0.6998 LVL 1 € = 4.1068 PLN 1 € = 4.2240 RON 1 € = 10.1432 SEK 1 € = 1.5160 CHF 1 € = 8.5550 NOK 1 € = 7.3083 HRK 1 € = 45.3900 RUB 1 € = 2.1324 TRY 1 € = 1.7197 AUD 1 € = 2.6289 BRL 1 € = 1.5541 CAD 1 € = 9.7891 CNY 1 € = 11.1074 HKD 1 € = 14352.49 IDR 1 € = 69.6870 INR 1 € = 1788.62 KRW 1 € = 18.3954 MXN 1 € = 5.0456 MYR 1 € = 2.1015 NZD 1 € = 69.378 PHP 1 € = 2.0620 SGD 1 € = 48.765 THB 1 € = 11.2261 ZAR
bunu çıkarıyor.
Benim istediğim sadece tek çıktı 1 TRY = 1.4880 (o an hangisiyse).Yani TL için vermesi.
Verilen kodlarda 1.4330 çıkarıyor fakat bu da 1 €'nun değeri. - 22-08-2009, 17:33:08
<?php $xml_ = new SimpleXMLElement('http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', NULL , true); $eur_tr = (float) $xml_->Cube->Cube->Cube[17]['rate']; //eur/tr $eur_usd = (float) $xml_->Cube->Cube->Cube[0]['rate']; //eur/usd //usd/tr echo $eur_tr / $eur_usd; ?>