Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/codes-snippets/config.php on line 6
Php Code Exchange Rate - Php

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