doqw89029 2018-03-25 12:26
浏览 91

Google财经转换器返回未定义的偏移量1

I am trying to implement this Google Finance Convertor in my project. I implemented it and it was working fine then. But today when I rechecked my application to ensure every thing is working properly I found out that the Google Finance Convertor API is not working and also returning an error.

PHP Code

/*********** Google Finance API ************/
  $from_Currency = "USD";
  $to_Currency = "INR";
  $encode_amount = $amount;
  $get = file_get_contents("http://finance.google.com/finance/converter?a=$encode_amount&from=$from_Currency&to=$to_Currency");
  $get = explode("<span class=bld>",$get);
  $get = explode("</span>",$get[1]);
  $converted_currency = preg_replace("/[^0-9\.]/", null, $get[0]);
  /*********** End Google Finance API ************/

It returns something like Undefined offset: 1

Complete Error Code

 Notice: Undefined offset: 1 in E:\xampp\htdocs\sitesedapple\gateways\payumoney\payumoney.php on line 31

Here in my code this line represents line number 31 $get = explode("</span>",$get[1]);

Please help.

  • 写回答

2条回答 默认 最新

  • du5591 2018-03-26 10:30
    关注

    Its because google has stopped providing finace api even finance.google.com takes us to google finance tab

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line