protected function getXML()
    {
        // if our cached data is ok
        if ($this->fetchedTimestamp !== null && (time() < $this->fetchedTimestamp + self::FETCH_CACHE_TIME) && $this->fetchedData !== null) {
            return $this->fetchedData;
        }

        //get current exchange rate XML
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curlHandle, CURLOPT_URL, "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
        $curlResponse = curl_exec($curlHandle);
        curl_close($curlHandle);

        // FIXME! Better error handling

        $this->fetchedData = $curlResponse;
        $this->fetchedTimestamp = time();

        return $this->fetchedData;
    }
protected function getXML()
    {
        // if our cached data is ok
        if ($this->fetchedTimestamp !== null && (time() < $this->fetchedTimestamp + self::FETCH_CACHE_TIME) && $this->fetchedData !== null) {
            return $this->fetchedData;
        }

        //get current exchange rate XML
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curlHandle, CURLOPT_URL, "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
        $curlResponse = curl_exec($curlHandle);
        curl_close($curlHandle);

        // FIXME! Better error handling

        $this->fetchedData = $curlResponse;
        $this->fetchedTimestamp = time();

        return $this->fetchedData;
    }
protected function getXML ( ) { // if our cached data is ok if ( $ this -> fetchedTimestamp !== null && ( time ( ) < $ this -> fetchedTimestamp + self :: FETCH_CACHE_TIME ) && $ this -> fetchedData !== null ) { return $ this -> fetchedData ; } //get current exchange rate XML $ curlHandle = curl_init ( ) ; curl_setopt ( $ curlHandle , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ curlHandle , CURLOPT_URL , "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" ) ; $ curlResponse = curl_exec ( $ curlHandle ) ; curl_close ( $ curlHandle ) ; // FIXME! Better error handling $ this -> fetchedData = $ curlResponse ; $ this -> fetchedTimestamp = time ( ) ; return $ this -> fetchedData ; }
Get the XML from ECB website - and cache it for some time

@return null|string
Get the XML from ECB website - and cache it for some time