我试图从国家银行获得货币。 他们支持的唯一方法是使用SOAP。
但我永远无法让它发挥作用......
首先我尝试了这个:
$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);
还试过这个:
$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);
这些是运营商: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>
但是我所有的时间都是以下错误:
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
我想指出,在查看我的php配置时,启用SOAP功能的所有内容。
我做错了吗?