From 56a975bed5a4e7904a8457a75b3df2b8dd2928f5 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 5 Oct 2015 15:25:11 +0800 Subject: [PATCH] DataObjects/Core_curr_rate.php --- DataObjects/Core_curr_rate.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/DataObjects/Core_curr_rate.php b/DataObjects/Core_curr_rate.php index 99a06e4e..20d8f0fa 100644 --- a/DataObjects/Core_curr_rate.php +++ b/DataObjects/Core_curr_rate.php @@ -66,20 +66,24 @@ class Pman_Core_DataObjects_Core_curr_rate extends DB_DataObject // this may fail... $f = @file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'); - if (strlen($f)) { - - $dom = simplexml_load_file($target); - $rates['EUR'] = 1.0; - $rates['TWD'] = 46.7008412; - $rates['VND'] = 26405.3; - - foreach($dom->Cube->Cube->Cube as $c) { - //echo '
';print_r($c );
-                $rates[(string)$c['currency']] = (string)$c['rate'];
-            }
-            $rates['RMB'] = $rates['CNY'] ;
+        if (!strlen($f)) {
+            return false;
         }
         
+        $dom = simplexml_load_file($target);
+        $rates['EUR'] = 1.0;
+        $rates['TWD'] = 46.7008412;
+        $rates['VND'] = 26405.3;
+       
+        foreach($dom->Cube->Cube->Cube as $c) {
+           //echo '
';print_r($c );
+            $rates[(string)$c['currency']] = (string)$c['rate'];
+        }
+        $rates['RMB'] = $rates['CNY'] ;
+        
+        
+        
+        
         
         
         
-- 
2.39.2