Oké akkor keresem. Pár perec
Megvan:
Szóval itt lett volna beüzemelve, de aztán mégsem kellett: hxxp://metector.hu/arfolyam.php
PHP kód:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.mnb.hu/arfolyamok.asmx");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "http://www.mnb.hu/webservices/GetCurrentExchangeRates"'
));
curl_setopt($ch, CURLOPT_POSTFIELDS, "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soap:Body>
<GetCurrentExchangeRates xmlns=\"http://www.mnb.hu/webservices/\"/>
</soap:Body>
</soap:Envelope>");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$soap_response = curl_exec($ch);
curl_close($ch);
echo "<br><br>Aktuális Euro devizaárfolyam: ";
$str = substr($soap_response,865,6);
echo $str;
intval($str+2);
A substr megoldás helyett lehetne kitalálni valami jobbat, most így nem tudom, de nem biztos hogy mindig ugyan oda esik az árfolyam(pozíciója), bár most jól működik ahogy látom. Nem sokat foglalkoztam vele, mert nem kellett, úgyhogy érdemes tesztelni mielőtt komolyabban felhasználod.
Könyvjelzők