我正在开发网上购物网站,在购物网站上所有产品的价格均为印度卢比(INR).我打算将我的购物车集成到PayPal支付网关.
我知道PayPal不支持INR.所以我必须将INR兑换成美元.
是否有任何API服务可以自动将INR转换为USD?如果是,请详细说明……
我知道PayPal不支持INR.所以我必须将INR兑换成美元.
是否有任何API服务可以自动将INR转换为USD?如果是,请详细说明……
您可以使用Google计算器API.
function currency_converter($from_Currency,$to_Currency,$amount) { $url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency"; $amount = urlencode($amount); $from_Currency = urlencode($from_Currency); $to_Currency = urlencode($to_Currency); $ch = curl_init(); $timeout = 0; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $rawdata = curl_exec($ch); curl_close($ch); $data = explode('"',$rawdata); $data = explode(' ',$data['3']); $var = $data['0']; return round($var,2); }
原文地址:https://www.jb51.cc/php/135013.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。