Guest User

Untitled

a guest
Mar 19th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public function getJPYtoUSDExchangeRate(){
  2. $from = 'JPY';
  3. $to = 'USD';
  4. $amount = 1;
  5. $data = file_get_contents("https://finance.google.com/finance/converter?a=$amount&from=$from&to=$to");
  6. preg_match("/(.*)/",$data, $converted);
  7. $converted = preg_replace("/[^0-9.]/", "", $converted[1][0]);
  8. return number_format(round($converted, 3),2);
  9. }
Add Comment
Please, Sign In to add comment