Want more features on Pastebin? Sign Up, it's FREE!
Guest

MNB aktuális árfolyam lekérdezés

By: a guest on Apr 1st, 2010  |  syntax: PHP  |  size: 0.53 KB  |  views: 758  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.    
  3.     $currency='USD';
  4.     $client = new SoapClient("http://www.mnb.hu/arfolyamok.asmx?wsdl");
  5.     $response = $client->__soapCall("GetCurrentExchangeRates", array());
  6.     $doc = new DOMDocument;
  7.     $doc->loadXML($response->GetCurrentExchangeRatesResult);
  8.     $xpath = new DOMXPath($doc);
  9.     $query = "//MNBCurrentExchangeRates/Day/Rate[@curr='$currency']";
  10.     $entries = $xpath->query($query);
  11.     if($entries->length){
  12.         var_dump($entries->item(0)->nodeValue);
  13.     } else {
  14.         echo "Error";  
  15.     }
  16.    
  17. ?>
clone this paste RAW Paste Data