我正在尝试开发一个电子商务网站。为了管理多币种,我想使用网络服务进行自动转换。所以我尝试了这个网络服务:http://www.webservicex.com/CurrencyConvertor.asmx?WSDL 用这段代码:
try
{
$wsdl="http://www.webservicex.com/CurrencyConvertor.asmx?WSDL";
$webservice = new 'SoapClient( $wsdl );
$country=array();
// Set the country variable to the country codes.
$country['FromCurrency']= 'USD';
$country['ToCurrency'] = 'EUR';
$webservice->ConversionRate($country);
echo $response->ConversionRateResult;*/
}catch(Exception $oException)
{
printf(
'<h4 style="color: Red">Exception</h4>
<p>%s</p>',
$oException->getMessage()
);
} `
不幸的是,该服务返回我 - 1我的代码有问题还是服务不再有效!!
您知道另一个稳定的 Web 服务吗?谢谢
看看
https://openexchangerates.org/
http://fixer.io/
它们都有可以直接集成的 API。