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. Quote Link to comment 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]; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.