相关疑难解决方法(0)

如何通过Google财经等API获取货币汇率?

现在,我确实找到了Google财经API并开始查看,但我发现了很多关于投资组合,交易,头寸和其他我一无所知的信息.

我在查看错误的文档吗?我需要做些什么来从GF获得汇率?这甚至可能吗?

编辑

让事情变得更加清晰.我对技术方面不感兴趣,也不想要任何代码.

api google-finance-api

137
推荐指数
6
解决办法
53万
查看次数

如何在 Php 中使用谷歌货币 API 转换货币?

我通过使用 file_get_content 在 php 中使用谷歌货币转换 API,但由于出现错误而无法获取输出,那么如何通过在 Php 中使用以下 API 来转换任何货币。

<?php  
 function convertCurrency($amount, $from, $to)  
 {  
      $url = "http://www.google.com/finance/converter?a=$amount&from=$from&to=$to";  
      $data = file_get_contents($url);  
      preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);  
      return $converted[1];  
 }  
 echo convertCurrency(1500, 'USD', 'INR');  
 ?> 
Run Code Online (Sandbox Code Playgroud)

出现这样的错误

Message: file_get_contents(http://www.google.com/finance/converter?a=1500&from=USD&to=INR): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
Run Code Online (Sandbox Code Playgroud)

php api currency

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

api ×2

currency ×1

google-finance-api ×1

php ×1