# The PHP Experts > Entwickler-Ratgeber: Domain-Verfügbarkeit per API prüfen, RDAP und Whois in PHP abfragen, DNS-Records lesen, Domain-Validierung, IDN und Punycode. The PHP Experts ist ein zweisprachiger Ratgeber (Deutsch/Englisch) der OnlineBuilders LLC. Domain-Preise auf dieser Website stammen aus dem Live-Preis-Feed des Registrars betadomain.de (https://betadomain.de/preise/), der ebenfalls zu OnlineBuilders gehört. Alle Preise sind Jahrespreise inklusive Verlängerung, ohne Lockangebote. ## Domain-APIs / Domain APIs - [Domain-API im Vergleich: RDAP, EPP, Registrar-REST](https://thephpexperts.de/domain-api/domain-api-vergleich/): Eine Domain-API ist eine Schnittstelle, über die Programme Domains prüfen, abfragen oder registrieren. Zum Lesen reichen öffentliche Wege wie RDAP oder eine freie Verfügbarkeits-API. Registrieren geht nur über einen Registrar: per EPP, wenn du selbst akkreditiert bist, sonst über die REST-API eines Registrars mit Konto, Zahlungsweg und Token. - [MCP-Server für Domains: Tools, Token und PHP-Client](https://thephpexperts.de/domain-api/mcp-domain-api/): Ein MCP-Server für Domains stellt KI-Assistenten wie Claude oder ChatGPT Werkzeuge bereit, um Verfügbarkeit, Preise und Registry-Daten abzufragen. betadomain betreibt einen unter https://betadomain.de/api/mcp mit fünf offenen Lese-Tools und drei Tools für eigene Domains und Bestellungen, die einen Bearer-Token brauchen. Der Kauf endet immer in einem menschlichen Checkout. - [Domain-Verfügbarkeit prüfen mit PHP: DNS, RDAP, API](https://thephpexperts.de/domain-api/php-domain-verfuegbarkeit-pruefen/): Verlässlich prüfst du die Verfügbarkeit einer Domain in PHP nur über die Registry oder einen Registrar, also per RDAP, Whois oder Registrar-API. Ein DNS-Lookup mit checkdnsrr() taugt als schneller Vorfilter: Hat die Domain NS-Records, ist sie vergeben. Fehlen sie, kann sie trotzdem registriert, reserviert oder in der Löschphase sein. - [RDAP in PHP: Domaindaten per JSON statt Whois](https://thephpexperts.de/domain-api/rdap-php/): Für eine RDAP-Abfrage in PHP lädst du die IANA-Bootstrap-Datei data.iana.org/rdap/dns.json, suchst darin den RDAP-Server der Endung und rufst per HTTPS /domain/ auf. Die Antwort ist JSON nach RFC 9083. HTTP 404 bedeutet in der Regel: nicht registriert. Für .de fehlt der Eintrag im Bootstrap, dort fragst du rdap.denic.de direkt. - [Whois in PHP: Abfrage über Port 43 mit fsockopen](https://thephpexperts.de/domain-api/whois-php/): Eine Whois-Abfrage in PHP ist eine TCP-Verbindung auf Port 43: fsockopen() zum Whois-Server der Endung, Domainname plus \r\n senden, Antwort bis zum Verbindungsende lesen. Den zuständigen Server liefert whois.iana.org. Bei .de erwartet whois.denic.de das Format „-T dn,ace domain.de“ und antwortet bei freien Domains mit „Status: free“. - [Domain Registration API: EPP, REST and RDAP Compared](https://thephpexperts.de/en/domain-api/domain-api-comparison/): A domain registration API lets software register and manage domains. Only accredited registrars can talk to registries directly over EPP; everyone else uses a registrar's REST API with an account, a token and a payment method. Read-only tasks such as availability or expiry lookups don't need registration access: RDAP or a public check API is enough. - [MCP Servers for Domains: Tools, Tokens, PHP Client](https://thephpexperts.de/en/domain-api/mcp-domain-tools/): An MCP server for domains gives AI assistants such as Claude or ChatGPT tools to check availability, prices and registry data instead of guessing. betadomain runs one at https://betadomain.de/api/mcp with five open read tools and three account tools that need a bearer token. Ordering always ends in a checkout link that a person completes. - [PHP: Check Domain Availability the Right Way](https://thephpexperts.de/en/domain-api/php-check-domain-availability/): To check domain availability in PHP reliably you have to ask the registry or a registrar, via RDAP, whois or a registrar API. A DNS lookup with checkdnsrr() only works as a pre-filter: if the domain has NS records it is taken, but a domain without them can still be registered, reserved or pending deletion. - [RDAP in PHP: Query Domain Data as JSON](https://thephpexperts.de/en/domain-api/rdap-php/): To query RDAP from PHP, download the IANA bootstrap file at data.iana.org/rdap/dns.json, look up the RDAP base URL for the domain's TLD and send GET /domain/ over HTTPS. The response is JSON defined in RFC 9083. HTTP 404 normally means the domain isn't registered. Some ccTLDs are missing from the bootstrap and need a hard-coded URL. - [Whois in PHP: Port 43 Lookups with fsockopen](https://thephpexperts.de/en/domain-api/whois-php/): A whois lookup in PHP is a TCP connection to port 43: open it with fsockopen(), send the domain followed by \r\n and read until the server closes the socket. whois.iana.org tells you which server handles each TLD. Responses are free text, so detecting a free domain means matching registry-specific phrases such as "No match for". ## DNS in PHP / DNS in PHP - [dns_get_record in PHP: DNS-Records lesen ohne Fallen](https://thephpexperts.de/dns-php/dns-get-record-php/): dns_get_record() fragt über den System-Resolver DNS-Records ab und gibt ein Array von Arrays zurück, je Record mit host, class, ttl, type und typabhängigen Feldern wie ip, target oder txt. Existiert ein Name nicht, kommt ein leeres Array. Bei Resolver-Fehlern gibt PHP false und eine Warnung aus. Einen eigenen Nameserver kannst du nicht angeben. - [DNS-Monitoring mit PHP: Änderungen per Cronjob erkennen](https://thephpexperts.de/dns-php/dns-monitoring-php/): Für DNS-Monitoring mit PHP fragst du die wichtigen Records einer Domain regelmäßig mit dns_get_record() ab, speicherst sie normalisiert als JSON und vergleichst jeden Lauf mit dem letzten Stand. Ändert sich ein A-, MX-, NS- oder TXT-Record, verschickt das Skript eine Meldung. Ein Cronjob alle fünf bis fünfzehn Minuten reicht für die meisten Projekte. - [MX-Record prüfen mit PHP: getmxrr, Null-MX, Fallback](https://thephpexperts.de/dns-php/mx-record-pruefen-php/): Einen MX-Record prüfst du in PHP mit dns_get_record($domain, DNS_MX) oder getmxrr(). Sortiere die Einträge nach pri, niedrigster Wert zuerst. Ein einzelner Eintrag mit leerem Ziel ist ein Null-MX nach RFC 7505: Die Domain nimmt bewusst keine Mail an. Fehlt der MX ganz, wird laut RFC 5321 an die A- oder AAAA-Adresse zugestellt. - [DNS Monitoring in PHP: Detect Record Changes via Cron](https://thephpexperts.de/en/dns-php/dns-monitoring-php/): DNS monitoring in PHP means querying a domain's important records with dns_get_record() on a schedule, storing them normalised as JSON and comparing each run with the previous one. When an A, MX, NS or TXT record changes, the script sends an alert. A cron job every five to fifteen minutes is enough for most projects. - [PHP: Check MX Records with Null MX and A Fallback](https://thephpexperts.de/en/dns-php/php-check-mx-record/): To check MX records in PHP, call dns_get_record($domain, DNS_MX) or getmxrr() and sort by pri, lowest first. A single record with an empty target is a null MX (RFC 7505), meaning the domain accepts no mail. With no MX at all, RFC 5321 says mail goes to the domain's A or AAAA address instead. - [PHP dns_get_record(): Return Values, Errors, Limits](https://thephpexperts.de/en/dns-php/php-dns-get-record/): PHP's dns_get_record() queries DNS through the system resolver and returns an array of records, each with host, class, ttl, type and type-specific keys such as ip, target or txt. A name that doesn't exist yields an empty array; a resolver failure yields false plus a warning. You can't choose the nameserver or set a timeout. ## Validierung / Validation - [Domain validieren mit Regex in PHP: Muster und Tests](https://thephpexperts.de/validierung/domain-validieren-regex/): Ein Domainname besteht aus Labels von 1 bis 63 Zeichen aus a–z, 0–9 und Bindestrich, die nicht mit einem Bindestrich beginnen oder enden, getrennt durch Punkte, insgesamt höchstens 253 Zeichen. In PHP prüfst du das mit einem Regex plus Lookahead für die Gesamtlänge. Umlaut-Domains wandelst du vorher mit idn_to_ascii() in Punycode um. - [E-Mail-Validierung in PHP: filter_var, MX und Umlaute](https://thephpexperts.de/validierung/email-validierung-php/): Für die E-Mail-Validierung in PHP nimmst du filter_var($email, FILTER_VALIDATE_EMAIL) für die Syntax, wandelst vorher den Domainteil mit idn_to_ascii() in Punycode um und prüfst per DNS, ob die Domain Mail annimmt, also MX oder A-Record ohne Null-MX. Ob das Postfach existiert, zeigt nur eine Bestätigungsmail. - [Punycode in PHP: IDN-Domains mit idn_to_ascii umwandeln](https://thephpexperts.de/validierung/idn-punycode-php/): In PHP wandelst du Umlaut-Domains mit idn_to_ascii() in Punycode um, zurück geht es mit idn_to_utf8(). Beide stammen aus der intl-Erweiterung. Übergib immer IDNA_NONTRANSITIONAL_TO_ASCII und INTL_IDNA_VARIANT_UTS46, sonst wird aus straße.de strasse.de statt xn--strae-oqa.de. Fehler liest du aus dem vierten Parameter $info['errors'] aus. - [Public Suffix List in PHP: Registrierbare Domain finden](https://thephpexperts.de/validierung/public-suffix-list-php/): Die Public Suffix List von publicsuffix.org verzeichnet alle Endungen, unter denen sich Domains registrieren lassen, auch mehrteilige wie co.uk. In PHP lädst du die Datei, suchst für einen Hostnamen die längste passende Regel und nimmst ein Label mehr dazu: Das ist die registrierbare Domain. Fertig umgesetzt ist das im Composer-Paket jeremykendall/php-domain-parser. - [Punycode in PHP: Convert IDNs with idn_to_ascii()](https://thephpexperts.de/en/validation/idn-punycode-php/): In PHP, convert internationalised domain names to punycode with idn_to_ascii() and back with idn_to_utf8(), both from the intl extension. Always pass IDNA_NONTRANSITIONAL_TO_ASCII with INTL_IDNA_VARIANT_UTS46, otherwise straße.de becomes strasse.de instead of xn--strae-oqa.de. Read failures from the fourth argument, $info['errors']. - [PHP Email Validation: filter_var, MX Checks and IDNs](https://thephpexperts.de/en/validation/php-email-validation/): For email validation in PHP, use filter_var($email, FILTER_VALIDATE_EMAIL) for syntax, convert the domain part to punycode with idn_to_ascii() first, and check via DNS that the domain accepts mail: an MX or A record and no null MX. Whether the mailbox exists can only be confirmed by sending a confirmation email. - [Public Suffix List in PHP: Get the Registrable Domain](https://thephpexperts.de/en/validation/public-suffix-list-php/): The Public Suffix List at publicsuffix.org lists every suffix under which names can be registered, including multi-part ones like co.uk. In PHP you load the file, find the longest rule matching a hostname and add one more label: that's the registrable domain. The Composer package jeremykendall/php-domain-parser implements the full algorithm. - [Validate a Domain Name with Regex in PHP (Tested)](https://thephpexperts.de/en/validation/validate-domain-name/): A valid domain name is a series of dot-separated labels, each 1 to 63 characters of a to z, 0 to 9 and hyphens, not starting or ending with a hyphen, at most 253 characters in total. In PHP, check it with a regex that uses a lookahead for the overall length, and convert internationalised names with idn_to_ascii() first. ## Optional - [Full text](https://thephpexperts.de/llms-full.txt): Alle Artikel als Klartext - [Sitemap](https://thephpexperts.de/sitemap.xml) - [betadomain.de](https://betadomain.de/llms.txt): Registrar mit Domain-API und MCP-Server