Hi i would like to add currency converter in my one of the website for USD to INR when Indian people can get money on direct his bank account and if they pay on site then it will show 100$ = this much INR is any bank provide this type of API ? or any online resources ? Thanks
you should use Google currency convert tool. This is function to do it in PHP function currencyConvert($from,$to,$amount){ $url = "http://www.google.com/finance/converter?a=$amount&from=$from&to=$to"; $request = curl_init(); $timeOut = 0; curl_setopt ($request, CURLOPT_URL, $url); curl_setopt ($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($request, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); curl_setopt ($request, CURLOPT_CONNECTTIMEOUT, $timeOut); $response = curl_exec($request); curl_close($request); return $response; } PHP: Required: Your host need turn curl on and allow running PHP Using: $huyhoaData = currencyConvert($from,$to,$amount); $regex = '#\<span class=bld\>(.+?)\<\/span\>#s'; preg_match($regex, $huyhoaData, $dataex); $show = $dataex[0]; echo $show; PHP: Where $from = currency code of original currency $to = converted currency. In your case, $from = 'USD'; $to = 'INR'; //Indian Rupee (Rs.) $amount = 'numeric amount want to change';
Hi Dhaval, Bank will give different rates, and that is not fix. we can negotiate with bank. what is your purpose? Bank rate would vary 15 to 20 paisa.
see this http://www.hdfcbank.com/assets/pdf/forex_rates/rates.pdf http://www.xe.com/ compare the USD rate xe and hdfc it is not 15 or 20 paisa diff.
Its on their website. I have its bank account. I got with max 25 paisa difference from xe when I get in my bank.
I don't think there's any bank providing a currency conversion API. I researched this topic a few months ago because I needed a cost-effective alternative to all the expensive providers like "XE": I'd highly recommend the currencylayer API - (https://currencylayer.com) What they offer: - exchange rates for 168 currencies - simple currency conversion - real-time rates and historical rates - a ton of cool features - perfect documentation What you'll pay: Nothing. They have a Free Plan that lets you make 1,000 API Calls per month - and if you need more than that, paid subscriptions are starting at $9.99/month, which is perfectly affordable for startups and smaller online businesses...