From e05d7f24eebdf3d0a1b04e8c48d8909a76093209 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sun, 22 May 2016 22:28:03 +0200 Subject: [PATCH] Bloomberg Rate has changed their wrapper from span to div. --- gl/includes/db/gl_db_rates.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gl/includes/db/gl_db_rates.inc b/gl/includes/db/gl_db_rates.inc index 70ab230a..1938c6bb 100644 --- a/gl/includes/db/gl_db_rates.inc +++ b/gl/includes/db/gl_db_rates.inc @@ -113,6 +113,7 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) { $filename = "/stats/eurofxref/eurofxref-daily.xml"; $site = "www.ecb.europa.eu"; + $site_ip="172.230.157.137"; } elseif ($provider == 'YAHOO') { @@ -120,16 +121,19 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) $site = "download.finance.yahoo.com"; //$filename = "/q?s={$curr_a}{$curr_b}=X"; // Let old code be here for a while, Joe. //$site = "finance.yahoo.com"; + $site_ip="203.84.220.151"; } elseif ($provider == 'GOOGLE') { $filename = "/finance/converter?a=1&from={$curr_a}&to={$curr_b}"; $site = "www.google.com"; + $site_ip = "74.125.23.147"; } elseif ($provider == 'BLOOMBERG') { $filename = "/quote/{$curr_b}{$curr_a}:CUR"; $site = "www.bloomberg.com"; + $site_ip = "23.35.88.72"; } $contents = ''; if (function_exists('curl_init')) @@ -149,7 +153,7 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) curl_close($ch); // due to resolver bug in some curl versions (e.g. 7.15.5) // try again for constant IP. - $site="172.230.157.137"; + $site=$site_ip; } while( ($contents == '') && $retry--); } else { @@ -207,11 +211,13 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) elseif ($provider == 'BLOOMBERG') { $val = ''; - $stmask = ''; - $val = trim(strstr($contents, $stmask)); - $stmask = chr(10); - $val = trim(strstr($val, $stmask)); - $val = trim(strtok($val, $stmask)); + $stmask = '
'; + $val = strstr($contents, $stmask); + $val = trim($val); + $val = substr($val, strlen($stmask)); + $stmask = '
'; + $val = strtok($val, $stmask); + $val = trim($val); } return $val; } /* end function get_extern_rate */ -- 2.30.2