Jump to content

Newbie Question - Exchange Rate Data


peterrust99

Recommended Posts

Hi, 

I'm a newbie and maybe this is simple but I'm not getting anywhere trying to solve it without help.  Anyway, my website has prices in us dollars and Thai Baht currency.  The Thai baht prices I just enter manually and don't change much.  US dollar prices are based on the thai baht prices.  The us dollar / thai baht exchange rate is live and I'd like to link the live data to this variable.  Now, I have to manually change the exchange rate manually every so often,  Is this possible in a simple way with php? 

 

$thb_usd = 32.63;

 

Thanks. 

Link to comment
https://forums.phpfreaks.com/topic/287142-newbie-question-exchange-rate-data/
Share on other sites

Try with below code

<?php

$from = 'THB';

$to = 'USD';


$handle = fopen($url, 'r');

 

if ($handle) {

    $result = fgetcsv($handle);

    fclose($handle);

}

echo '1 '.$from.' =  '.$result[0].' '.$to.' as on '.$result[1].', '.$result[2];

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.