+ $contents = str_replace ("<Cube currency='USD'", " <Cube currency='EUR' rate='1'/> <Cube currency='USD'", $contents);
+ $from_mask = "|<Cube\s*currency=\'" . $curr_a . "\'\s*rate=\'([\d.,]*)\'\s*/>|i";
+ preg_match ( $from_mask, $contents, $out );
+ $val_a = isset($out[1]) ? $out[1] : 0;
+ $val_a = str_replace ( ',', '', $val_a );
+ $to_mask = "|<Cube\s*currency=\'" . $curr_b . "\'\s*rate=\'([\d.,]*)\'\s*/>|i";
+ preg_match ( $to_mask, $contents, $out );
+ $val_b = isset($out[1]) ? $out[1] : 0;
+ $val_b = str_replace ( ',', '', $val_b );
+ if ($val_b)
+ {
+ $val = $val_a / $val_b;
+ }
+ else
+ {
+ $val = 0;
+ }
+ }
+ elseif ($provider == 'YAHOO')