Example for using PHP accessing our API:
// ----------------------------------------------------------------------- // Konstanten // ----------------------------------------------------------------------- define (FRITZ_ROBOT_URL,"https://api.fritz.gmbh/"); define (auth_login,"Ihr-Benutzer"); define (auth_password,"Ihr-Kennwort"); define(TECHC_DEFAULT_HANDLE,"Ihr-Handle"); define(ZONEC_DEFAULT_HANDLE,"Ihr-Handle"); class fritzApi { var $domainname; var $owner_c; var $admin_c; var $tech_c = TECHC_DEFAULT_HANDLE; var $zone_c = ZONEC_DEFAULT_HANDLE; // Fritz Managed IT GmbH Standard-DNS-Server var $dns1 = "m.de.ha-dns.net"; var $dns2 = "ka2.de.ha-dns.net"; var $dns3 = "f2.de.ha-dns.net"; var $dns4 = "lxa.us.ha-dns.net"; // ----------------------------------------------------------------------- // Hilfsfunktionen und Funktionen fuer API-Aufrufe // ----------------------------------------------------------------------- function CurlPost($sMessage) { $ch = curl_init(); // Ignore https / SSL errors: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_URL, FRITZ_ROBOT_URL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $sMessage); // Call remote URL and get results $sResult = curl_exec($ch); curl_close ($ch); // Return error or status messages return $sResult; } function DomainCreate() { $sBody = array("task" => "DOMAIN.CREATE", "auth_login" => auth_login, "auth_password" => auth_password, "domain" => $this->domainname, "owner_c" => $this->owner_c, "admin_c" => $this->admin_c, "tech_c" => $this->tech_c, "zone_c" => $this->zone_c, "dns1" => $this->dns1, "dns2" => $this->dns2, "dns3" => $this->dns3, "dns4" => $this->dns4 ); // Call API return $this->CurlPost($sBody); } function DomainWhois() { $sBody = array("task" => "DOMAIN.WHOIS", "auth_login" => auth_login, "auth_password" => auth_password, "domain" => $this->domainname, ); // Call API return $this->CurlPost($sBody); } } // ----------------------------------------------------------------------- // Beispiel-Aufrufe: // ----------------------------------------------------------------------- // Neues Objekt aus Klasse instanzieren: $objDomain = new fritzApi(); $objDomain->domainname = "neue-domain.de"; // Neue Domain neue-domain.de registrieren $objDomain->owner_c = "PEM1"; // exemplarisch Handle PEM1 $objDomain->admin_c = "PEM1"; // exemplarisch Handle PEM1 // Klassen-Funktion Domain.Create aufrufen: print $objDomain->DomainCreate(); // Klassen-Funktion Domain.WHOIS aufrufen: $objDomain->domainname = "existierende-domain.de"; print $objDomain->DomainWhois();