Skip to content
Snippets Groups Projects
cozaepp.php 31.8 KiB
Newer Older
	$registrarinfo = $client->request('
<epp:epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
		xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
	<epp:command>
		<epp:info>
			<domain:info xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
				<domain:name hosts="all">'.$domain.'</domain:name>
			</domain:info>
		</epp:info>
	</epp:command>
</epp:epp>
');
	$doc= new DOMDocument();
	$doc->loadXML($registrarinfo);
	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
	# Check result
	if($coderes != '1000') {
		$values['error'] = "Sync/domain-info($domain): Code("._cozaepp_message($coderes).") $msg";
		return $values;
	}

	# Check if we can get a status back
	if($doc->getElementsByTagName('status')->item(0)) {
		$statusres = $doc->getElementsByTagName('status')->item(0)->getAttribute('s');
		$createdate = substr($doc->getElementsByTagName('crDate')->item(0)->nodeValue,0,10);
		$nextduedate = substr($doc->getElementsByTagName('exDate')->item(0)->nodeValue,0,10);
	} else {
		$values['error'] = "Sync/domain-info($domain): Domain not found";
		return $values;
	}

	$values['status'] = $msg;

	# Check status and update
	if ($statusres == "ok") {
		$values['active'] = true;

	} elseif ($statusres == "serverHold") {

	} elseif ($statusres == "expired") {
		$values['expired'] = true;

	} else {
		$values['error'] = "Sync/domain-info($domain): Unknown status code '$statusres' (File a bug report here: http://devlabs.linuxassist.net/projects/whmcs-coza-epp/issues/new)";
	}

	$values['expirydate'] = $nextduedate;

	return $values;
}