Änderungen

Wechseln zu: Navigation, Suche

Domain-Registrar-Module erstellen

13.945 Byte hinzugefügt, 22:03, 12. Okt. 2018
== Domain-Synchronisation ==
Domains werden periodisch synchronisiert, dazu wird die Methode <code>syncDomain($domain, $kkSync = false)</code> aufgerufen.Ist <code>$kkSync</code> auf <code>true</code> gesetzt, befindet sich die Domain noch im Transfer-Status.Sofern die Domain noch nicht transferiert wurde, ist <code>Array("status" => "waiting_kk")</code> zurückzugegeben.
== Kostenloses SSL-Zertifikat ==...Die erwartete Rückgabe für eine registrierte Domain ist ein Array mit den folgenden Schlüsseln:
== Kontakt* <code>auto_renew</code> -Boolean, der den Status der automatischen Verlängerung zurückgibt* <code>expiration</code> - Datum des Domainablaufs im Format ==YYYY-MM-DD...* <code>status</code> - Boolean, der den Status der Domain (aktiv/nicht aktiv) zurückgibt* <code>transfer_lock</code> - Boolean, der angibt, ob die Transfer-Sperre aktiviert ist* <code>privacy</code> - Boolean, der den Status der WHOIS-Privacy angibt
== Beispiel-Code ==
<source lang="php"><?php class InterNetWorX extends DomainRegistrar { protected $short = "inwx"; protected $name = "InterNetWorX"; protected $version = "1.0";  public function getSettings() { return Array( "api_user" => Array("type" => "text", "name" => "Benutzername"), "api_password" => Array("type" => "password", "name" => "Passwort"), ); }  public function availibilityStatus($domain) { if (!function_exists('xmlrpc_encode_request')) { return null; }  require_once __DIR__ ."/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] == "1000") { $res = $domrobot->call("domain", "check", Array("domain" => $domain), $this); }  if (!isset($res['resData']['domain'][0]['avail']) || $res['resData']['domain'][0]['avail'] === null) { return null; }  $domrobot->logout();  return (bool) $res['resData']['domain'][0]['avail']; }  public function registerDomain($domain, $owner, $admin, $tech, $zone, $ns, $privacy = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return $res; }  $arr = Array("owner", "admin", "tech", "zone");  foreach ($arr as $t) { $i = $$t;  $i[7] = str_replace(Array(" ", "-", "/"), "", $i[7]); $i[8] = str_replace(Array(" ", "-", "/"), "", $i[8]);  $res = $domrobot->call("contact", "create", Array( "type" => empty($i[2]) ? "PERSON" : "ORG", "name" => $i[0] . " " . $i[1], "org" => $i[2], "street" => str_replace(Array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü"), Array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue"), $i[3]), "city" => $i[6], "pc" => $i[5], "cc" => $i[4], "voice" => $i[7], "fax" => $i[8], "email" => $i[9], ), $this, $domain);  if ($res['code'] != "1000") { return $res; }  $$t = $res['resData']['id']; }  $res = $domrobot->call("domain", "create", Array( "domain" => $domain, "registrant" => $owner, "admin" => $admin, "tech" => $tech, "billing" => $zone, "ns" => $ns, "renewalMode" => "AUTOEXPIRE", ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return $res; }  $domrobot->logout(); return true; }  public function transferDomain($domain, $owner, $admin, $tech, $zone, $authCode, $ns, $privacy = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return $res; }  $arr = Array("owner", "admin", "tech", "zone");  foreach ($arr as $t) { $i = $$t;  $i[7] = str_replace(Array(" ", "-", "/"), "", $i[7]); $i[8] = str_replace(Array(" ", "-", "/"), "", $i[8]);  $res = $domrobot->call("contact", "create", Array( "type" => empty($i[2]) ? "PERSON" : "ORG", "name" => $i[0] . " " . $i[1], "org" => $i[2], "street" => str_replace(Array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü"), Array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue"), $i[3]), "city" => $i[6], "pc" => $i[5], "cc" => $i[4], "voice" => $i[7], "fax" => $i[8], "email" => $i[9], ), $this, $domain);  if ($res['code'] != "1000") { return $res; }  $$t = $res['resData']['id']; }  $res = $domrobot->call("domain", "transfer", Array( "domain" => $domain, "registrant" => $owner, "admin" => $admin, "tech" => $tech, "billing" => $zone, "ns" => $ns, "renewalMode" => "AUTOEXPIRE", "authCode" => $authCode, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return $res; }  $domrobot->logout(); return true; }  public function deleteDomain($domain, $transit = 0) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return false; }  if ($transit == 0) { $res = $domrobot->call("domain", "delete", Array( "domain" => $domain, ), $this); } else { $res = $domrobot->call("domain", "push", Array( "domain" => $domain, ), $this); }  if ($res['code'] != "1000" && $res['code'] != "1001") { return false; }  return true; }  public function getAuthCode($domain) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return false; }  $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $count = mb_strlen($chars); for ($i = 0, $pwd = ''; $i < 12; $i++) { $index = rand(0, $count - 1); $pwd .= mb_substr($chars, $index, 1); }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "authCode" => $pwd, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return false; }  return "AUTH:" . $pwd; }  public function changeNameserver($domain, $ns) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return false; }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "ns" => $ns, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return false; }  return true; }  public function changeContact($domain, $owner, $admin, $tech, $zone) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return false; }  $arr = Array("owner", "admin", "tech", "zone");  foreach ($arr as $t) { $i = $$t;  $i[7] = str_replace(Array(" ", "-", "/"), "", $i[7]); $i[8] = str_replace(Array(" ", "-", "/"), "", $i[8]);  $res = $domrobot->call("contact", "create", Array( "type" => empty($i[2]) ? "PERSON" : "ORG", "name" => $i[0] . " " . $i[1], "org" => $i[2], "street" => str_replace(Array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü"), Array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue"), $i[3]), "city" => $i[6], "pc" => $i[5], "cc" => $i[4], "voice" => $i[7], "fax" => $i[8], "email" => $i[9], ), $this, $domain);  if ($res['code'] != "1000") { return false; }  $$t = $res['resData']['id']; }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "registrant" => $owner, "admin" => $admin, "tech" => $tech, "billing" => $zone, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return false; }  return true; }  public function setRegLock($domain, $status = false, $error = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return $res; }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "transferLock" => $status, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return $res; }  return true; }  public function changeAll($domain, $owner, $admin, $tech, $zone, $ns, $status = false, $renew = true, $privacy = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return $res; }  $arr = Array("owner", "admin", "tech", "zone");  foreach ($arr as $t) { $i = $$t;  if (count($i) == 0) { $r = $this->syncDomain($domain); if (empty($r) || !is_array($r) || empty($r['ownerc'])) { return false; }  $$t = $r['ownerc']; } else { $i[7] = str_replace(Array(" ", "-", "/"), "", $i[7]); $i[8] = str_replace(Array(" ", "-", "/"), "", $i[8]);  $res = $domrobot->call("contact", "create", Array( "type" => empty($i[2]) ? "PERSON" : "ORG", "name" => $i[0] . " " . $i[1], "org" => $i[2], "street" => str_replace(Array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü"), Array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue"), $i[3]), "city" => $i[6], "pc" => $i[5], "cc" => $i[4], "voice" => $i[7], "fax" => $i[8], "email" => $i[9], ), $this, $domain);  if ($res['code'] != "1000") { return $res; }  $$t = $res['resData']['id']; } }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "registrant" => $owner, "admin" => $admin, "tech" => $tech, "billing" => $zone, "transferLock" => $status, "renewalMode" => $renew ? "AUTORENEW" : "AUTOEXPIRE", "ns" => $ns, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return $res; }  return true; }  public function syncDomain($domain, $kkSync = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return "Login failure"; }  $res = $domrobot->call("domain", "info", Array( "domain" => $domain, ), $this);  if ($res['code'] != "1000") { if ($kkSync) { return ["status" => "waiting_kk"]; }  return false; }  return Array( "auto_renew" => $res['resData']['renewalMode'] == "AUTORENEW", "expiration" => date("Y-m-d", $res['resData']['exDate']->timestamp), "status" => $res['resData']['status'] == "OK", "transfer_lock" => (bool) $res['resData']['transferLock'], "ownerc" => $res['resData']['contact']['registrant']['id'], "privacy" => false, ); }  public function trade($domain, $owner, $admin, $tech, $zone) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return false; }  $arr = Array("owner", "admin", "tech", "zone");  foreach ($arr as $t) { $i = $$t;  $i[7] = str_replace(Array(" ", "-", "/"), "", $i[7]); $i[8] = str_replace(Array(" ", "-", "/"), "", $i[8]);  $res = $domrobot->call("contact", "create", Array( "type" => empty($i[2]) ? "PERSON" : "ORG", "name" => $i[0] . " " . $i[1], "org" => $i[2], "street" => str_replace(Array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü"), Array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue"), $i[3]), "city" => $i[6], "pc" => $i[5], "cc" => $i[4], "voice" => $i[7], "fax" => $i[8], "email" => $i[9], ), $this, $domain);  if ($res['code'] != "1000") { return false; }  $$t = $res['resData']['id']; }  $res = $domrobot->call("domain", "trade", Array( "domain" => $domain, "registrant" => $owner, "admin" => $admin, "tech" => $tech, "billing" => $zone, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return false; }  return true; }  public function changeValues($domain, $status = false, $renew = true, $privacy = false) { require_once __DIR__ . "/domrobot.class.php"; $addr = "https://api.domrobot.com/xmlrpc/"; $domrobot = new domrobot($addr); $domrobot->setDebug(false); $domrobot->setLanguage('en'); $res = $domrobot->login($this->options->api_user, $this->options->api_password);  if ($res['code'] != "1000") { return $res; }  $res = $domrobot->call("domain", "update", Array( "domain" => $domain, "renewalMode" => $renew ? "AUTORENEW" : "AUTOEXPIRE", "transferLock" => $status, ), $this);  if ($res['code'] != "1000" && $res['code'] != "1001") { return $res; }  return true; }}</source>