public 通过GOOGLE(谷歌) API获取实时货币汇率(人民币和美金)的PHP代码

info

view_module通过GOOGLE(谷歌) API获取实时货币汇率(人民币和美金)的PHP代码

调用方法:

echo $this->currency("USD", "CNY", 1);die;


当前(2016年6月11日汇率是6.56)

2016-06-11_210151.jpg

函数:

function currency($from_Currency, $to_Currency, $amount) {

    $url = "https://www.google.com/finance/converter?a=" . $amount . "&from=" . $from_Currency . "&to=" . $to_Currency;


    $ch = curl_init();

    $timeout = 0;

    curl_setopt ($ch, CURLOPT_URL, $url);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    $rawdata = curl_exec($ch);

    curl_close($ch);


    $matches = array();

    preg_match_all("|<span class=bld>(.*)</span>|U", $rawdata, $matches);


    $result = explode(" ", $matches[1][0]);


    return round($result[0], 2);

}

2016-06-11_205917.jpg


申请在线申请ASI

参考价: $0

美国ASI协会方案
+¥5500
+¥4500
+¥40000
+¥1500
+¥4000

exit_to_app培训(60)
exit_to_app西联汇款(11)
exit_to_app外贸工具(15)
exit_to_app低成本创业(18)
exit_to_app关税(13)
exit_to_app产品风险(24)
exit_to_appPaypal(21)
exit_to_app邮件(13)
exit_to_app信用卡(7)
exit_to_appASI手册(27)
exit_to_app外贸SEO(9)
exit_to_appphotoshop技巧(6)
exit_to_app销售技巧(2)
exit_to_app供应商黑白名单(5)
exit_to_app海运费策略(26)
exit_to_app快递策略(38)
exit_to_appDDP(4)
exit_to_appDC(2)
exit_to_appGmail(13)
exit_to_app产品培训(4)
exit_to_app外贸询盘(5)
exit_to_appASI(87)
exit_to_app卖法研究(4)
exit_to_app关税(13)
exit_to_app业务员故事(4)
exit_to_app离岸公司(10)
exit_to_app包装(7)
exit_to_app谈判技巧(14)
exit_to_app验货(5)
exit_to_appsage(7)
exit_to_app看老外学英语(12)
exit_to_app开发客户渠道(5)
exit_to_appKMH提成系统(3)
exit_to_app品牌授权(2)
exit_to_app潘通色卡(4)
exit_to_app印刷(11)
exit_to_app矢量图(10)
exit_to_app收款(22)
exit_to_app程序代码(23)
exit_to_app美国ASI代理(21)