<?php
function get_string_between($str,$start,$end){
$str=' '.$str;
$ini=strpos($str,$start);
if($ini==0) return $tbl;
$ini+=strlen($start);
$len=strpos($str,$end,$ini) - $ini;
return substr($str,$ini,$len);
}
function fix($va){
$va=strip_tags($va);
$va=htmlentities($va);
return stripslashes($va);
}
if(isset($_GET['from'])) $from=fix($_GET['from']);
else exit();
if(isset($_GET['to'])) $to=fix($_GET['to']);
else exit();
if(isset($_GET['num'])) $num=fix($_GET['num']);
else exit();
$fs=file_get_contents('http://www.google.com/finance/converter?a='.$num.'&from='.$from.'&to='.$to);
$parsed=get_string_between($fs,'ss=bld>',' '.$to.'</span>');
echo $parsed;
?>
Example: I am going to currencies.php?from=USD&to=EUR&num=1 and I am getting 0.7000