peterrust99 Posted March 21, 2014 Share Posted March 21, 2014 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 More sharing options...
VijayaGanapathy Posted March 21, 2014 Share Posted March 21, 2014 Try with below code <?php $from = 'THB'; $to = 'USD'; $url = 'http://finance.yahoo.com/d/quotes.csv?f=l1d1t1&s='.$from.$to.'=X'; $handle = fopen($url, 'r'); if ($handle) { $result = fgetcsv($handle); fclose($handle); } echo '1 '.$from.' = '.$result[0].' '.$to.' as on '.$result[1].', '.$result[2]; ?> Link to comment https://forums.phpfreaks.com/topic/287142-newbie-question-exchange-rate-data/#findComment-1473434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.