Index: branches/5.2.x/units/helpers/ecb_currency_rates.php =================================================================== diff -u -N -r16516 -r16601 --- branches/5.2.x/units/helpers/ecb_currency_rates.php (.../ecb_currency_rates.php) (revision 16516) +++ branches/5.2.x/units/helpers/ecb_currency_rates.php (.../ecb_currency_rates.php) (revision 16601) @@ -1,6 +1,6 @@ RateSource = 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml'; + $this->RateSource = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'; parent::__construct(); } @@ -28,9 +28,14 @@ /** @var kCurlHelper $curl_helper */ $curl_helper = $this->Application->recallObject('CurlHelper'); + $curl_helper->followLocation = true; $xml = $curl_helper->Send($this->RateSource); + if ( !$curl_helper->isGoodResponseCode() || strlen($xml) == 0 ) { + return; + } + xml_parse_into_struct($xml_parser, $xml, $struct, $index); $data_res = Array(); foreach($struct as $element) @@ -44,13 +49,14 @@ $data_res[$currency]['RATE'] = ($element['attributes']['RATE'] == 0) ? 0 : 1 / $element['attributes']['RATE']; } } - if(!$data_res['EUR']) - { + + if ( !isset($data_res['EUR']) ) { $data_res['EUR']['ID'] = 'EUR'; $data_res['EUR']['UNITS'] = 1; $data_res['EUR']['TARGET'] = 'EUR'; $data_res['EUR']['RATE'] = 1; } + $this->ExchangeRates = $data_res; } }