function currency($icoin2, $icoin1, $value=1) { $coin1 = strtoupper($icoin1); $coin2 = strtoupper($icoin2); $coin1 = preg_replace("/[^A-Z{3}]/", null, $coin1); $coin2 = preg_replace("/[^A-Z{3}]/", null, $coin2); $currency = @file_get_contents('http://download.finance.yahoo.com/d/quotes.csv?s='.$coin2.$coin1.'=X&f=sl1d1t1ba&e=.csv'); $currency = explode(",", $currency); $value = (float)($currency[1]*$value); return $value; }