/** * Get a list of all the domains * * @param string $contactHandle The handle of a contact, so the list could be filtered (useful for updating domain whois data) * * @return array|bool * * @throws Api_Odr_Exception */ public function getDomainList($contactHandle = '') { if (!$this->_checkLogin()) { return false; } $filter = array(); if ($contactHandle) { $filter['contact'] = $contactHandle; } $filter['status_not'] = 'DELETED'; $tlds = $this->getAvailableTlds(); if (!empty($tlds)) { $filter['tlds'] = implode(',', $tlds); } try { $result = $this->odr->getDomains($filter)->getResult(); } catch (\Exception $e) { return $this->parseError($e); } if ($result['status'] !== Api_Odr::STATUS_SUCCESS) { return $this->parseError($result['response']); } if (!empty($result['response']['status']) && $result['response']['status'] === 'FAILED') { return $this->parseError(empty($result['response']['data']['message']) ? 'Incorrectly formatted response' : $result['response']['data']['message']); } $domains = array(); foreach ($result['response'] as $domain) { $domains[] = array('Domain' => $domain['api_handle'] . '.' . $domain['tld'], 'Information' => array('nameservers' => array(), 'whois' => null, 'expires' => date('Y-m-d', strtotime(!empty($domain['expiration_date']) ? $domain['expiration_date'] : $domain['expiration_at'])), 'regdate' => '', 'authkey' => '')); } return $domains; }