Php Code Exchange Rate - Php

How to get exchange rate using php code?

Snippet Code

Rate this page :
  [ 0 votes]

The below code allows you to calculate live Indian Rupee to US Dollar foreign exchange rates. You can get live currency exchange rates from Yahoo Finance using PHP code.

<?php $from = 'INR'; $to = 'USD'; $url = ''.$from.$to.'=X'; $handle = fopen($url, 'r'); if ($handle) { $result = fgetcsv($handle); fclose($handle); } echo 'One '.$from.' is worth '.$result[0].' '.$to.' Based on data on '.$result[1].' '.$result[2]; ?>


Ask Questions

Ask Question