iGoogle正在关闭.
有一个(未记录的?)货币转换API可用于以下网址:http://www.google.com/ig/calculator?hl = en&q = 1GBP =? USD
此网址的基础 - google.com/ig-将您带到iGoogle.iGoogle关闭后API是否可用?
Sim*_*ies 19
我遇到了同样的问题:https://stackoverflow.com/a/19786423/2819754
我使用@hobailey答案进行临时修复,直到我可以将其更新到另一个版本或谷歌决定做一个正确的API.
谷歌将URL更改为
https://www.google.com/finance/converter?a
Run Code Online (Sandbox Code Playgroud)
所以我发现的修复方法如下.
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$get = file_get_contents("https://www.google.com/finance/converter?a=$amount&from=$from_Currency&to=$to_Currency");
$get = explode("<span class=bld>",$get);
$get = explode("</span>",$get[1]);
$converted_amount = preg_replace("/[^0-9\.]/", null, $get[0]);
Run Code Online (Sandbox Code Playgroud)
感谢@hobailey这个小小的修复.
小智 9
或者您可以使用以下内容:
但第一个不是稳定性经常超出容量.几个月前,我们使用第一个交换服务在我们的生产环境中遇到了极端问题.到目前为止第二个是稳定的,不会造成任何问题.