setErrorMessage("API URL unknown"); return false; } /** * Extract price information from API data **/ public function getPrice() { $aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']); $strCurrency = $this->config['currency']; // Check the API type for configured URL if (!$strApiType = $this->getApiType($this->config['price']['url'])) return false; // Extract price depending on API type switch ($strApiType) { case 'coinchose': foreach ($aData as $aItem) { if($strCurrency == $aItem[0]) return $aItem['price']; } break; case 'btce': return $aData['ticker']['last']; break; } // Catchall, we have no data extractor for this API url $this->setErrorMessage("Undefined API to getPrice() on URL " . $this->config['price']['url']); return false; } } $tools = new Tools(); $tools->setDebug($debug); $tools->setConfig($config);