I'm trying to get the currency from the National Bank. The only way they support is with SOAP.
But I can never get it to work...
Firstly I tried this:
$soapclient = new SoapClient('http://www.nbrm.gov.mk/klservice/kurs.asmx');
$params = array('StartDate' => '10.08.2016', 'EndDate' => '10.08.2016');
$response = $soapclient->GetExchangeRate($params);
var_dump($response);
Also tried this:
$url = 'http://www.nbrm.gov.mk/klservice/kurs.asmx';
$client = new SoapClient($url);
$xmlr = new SimpleXMLElement("<GetExchangeRate></GetExchangeRate>");
$xmlr->addChild('StartDate', '10.08.2016');
$xmlr->addChild('EndDate', '10.08.2016');
$params = new stdClass();
$params->xml = $xmlr->asXML();
$result = $client->CustomerSearchS($params);
These would be the operators: http://www.nbrm.mk/klservice/kurs.asmx?op=GetExchangeRate
POST /klservice/kurs.asmx HTTP/1.1
Host: www.nbrm.mk
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.nbrm.mk/klservice/GetExchangeRate"
<?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>
<GetExchangeRate xmlns="http://www.nbrm.mk/klservice/">
<StartDate>string</StartDate>
<EndDate>string</EndDate>
</GetExchangeRate>
</soap:Body>
</soap:Envelope>
However all I get all the time is the following error:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.nbrm.gov.mk/klservice/kurs.asmx' : failed to load external entity "http://www.nbrm.gov.mk/klservice/kurs.asmx" in
I'd like to point out that when viewing my php configuration everything for SOAP to function is enabled.
Am I doing something wrong?