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 = 'http://finance.yahoo.com/d/quotes.csv?f=l1d1t1amps='.$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]; ?>

Tags


Ask Questions

Ask Question