阿里云實(shí)時(shí)外匯查詢接口
二次開發(fā) admin 發(fā)布時(shí)間:2023-11-17 09:01:15 瀏覽: 次
阿里云推出了實(shí)時(shí)外匯查詢接口,也很便宜,通遼易聯(lián)通達(dá)給客戶對(duì)接如下
public function currency_exchange($fromCode, $toCode, $money=0) {
if( $fromCode == "" || $toCode == "" ) {
exit('Please Input exchange_rate param: fromCode, toCode');
}
$host = "https://tysjhlcx.market.alicloudapi.com";
$path = "/exchange_rate/convert";
$method = "GET";
$appcode = "8a18d0903f734832a49bb3992a8d85bd";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "fromCode=".$fromCode."&toCode=".$toCode."&money=".$money;
$bodys = "";
$url = $host . $path . "?" . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
//var_dump(curl_exec($curl));
$response = curl_exec($curl);
有需要的朋友可以聯(lián)系我們
相關(guān)推薦
- 阿里云的輕量應(yīng)用服務(wù)器和云服務(wù)器有什么區(qū)別?
- ecshop等電商網(wǎng)站對(duì)接阿里云短信驗(yàn)證碼功能(PHP版本)
- 如果利用京東聯(lián)盟API把京東的商品展示在自己的網(wǎng)站(PH
- 工商銀行在線支付接口,B2C簽名infosec插件
- 網(wǎng)站接入手機(jī)驗(yàn)證碼,網(wǎng)站接入短信驗(yàn)證碼功能,短信驗(yàn)證碼
- 瀚銀ecshop,thinkphp,shopnc在線支付接口,支付插件(pay
- 現(xiàn)代金控ecshop,thinkphp,shopnc在線支付接口,支付插件
- 首信易ecshop,thinkphp,shopnc在線支付接口,支付插件(p
- 環(huán)迅ecshop,thinkphp,shopnc在線支付接口,支付插件(pay
- 愛農(nóng)ecshop,thinkphp,shopnc在線支付接口,支付插件(pay