Topic: Adapting to google's error when getting exchange rates.
I have found google does not convert following currencies STD, ITL, IRR, FRF, DEM, VND, BYR to USD but it does opposite (USD to those currencies).
Should we change lines 213-225 of gl_db_rates.inc
elseif ($provider == 'GOOGLE')
{
$val = '';
$regexp = "%([\d|.]+)\s+{$curr_a}\s+=\s+<span\sclass=(.*)>([\d|.]+)\s+{$curr_b}\s*</span>%s";
if (preg_match($regexp, $contents, $matches))
{
$val = $matches[3];
$val = str_replace(',', '', $val);
if ($val != 0)
$val = 1 / $val;
}
}
TO
elseif ($provider == 'GOOGLE')
{
$val = '';
$regexp = "%([\d|.]+)\s+{$curr_a}\s+=\s+<span\sclass=(.*)>([\d|.]+)\s+{$curr_b}\s*</span>%s";
if (preg_match($regexp, $contents, $matches))
{
$val = $matches[3];
$val = str_replace(',', '', $val);
if ($val != 0)
$val = 1 / $val;
}
// Start of New Code lines
if(!$val) {
$filename = "/finance/converter?a=1&from={$curr_b}&to={$curr_a}";
$regexp = "%([\d|.]+)\s+{$curr_b}\s+=\s+<span\sclass=(.*)>([\d|.]+)\s+{$curr_a}\s*</span>%s";
$contents = url_get_contents("http://".$site.$filename);
if (preg_match($regexp, $contents, $matches)) {
$val = $matches[3];
$val = str_replace(',', '', $val);
}
}
// End of New code lines
}
to adapting to the google's issue ?
if this issue will not be solved FA will shows folowing red error comment:
number_format() expects parameter 2 to be integer, float given in file: C:\xampp\htdocs\fa243\includes\current_user.inc at line 318