iGoogle 是关闭 https://support.google.com/websearch/answer/2664197?hl=en.
有一个(未记录?)货币转换 API,其 URL 如下:
此网址的基础 - google.com/ig - 将您带到 iGoogle。 iGoogle 关闭后 API 还可用吗?
我遇到了这里描述的相同问题:https://stackoverflow.com/a/19786423/2819754 https://stackoverflow.com/a/19786423/2819754
我使用 @hobailey 答案进行临时修复,直到我可以将其更新到另一个版本或谷歌决定执行适当的 api。
由于谷歌将网址更改为
https://www.google.com/finance/converter?a
所以我找到的修复如下。
$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]);
感谢@hobailey 的这个小修复。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)