getdns Functions
PHP Manual


(PECL getdns >= 0.10.0)

php_getdns_convert_fqdn_to_dns_nameConvert a domain name in presentation format to DNS format.


int php_getdns_convert_fqdn_to_dns_name ( string $string , string &$bindata )

This function converts a fully-qualified domain name (FQDN) in presentation format represented as a null-terminated character string with interior dots to DNS format. Names in DNS fields are stored in a fashion very different from the normal presentation format normally used in applications. The DNS format is described in the first paragraph in Section 3.1 of » RFC 1035. This helper function only works with names in DNS format that are not compressed. It is useful for converting domain names in the replies_tree to and from the FQDN presentation format.



A string value containing a FQDN in presentation format.


The bindata value to be returned that will contain a FQDN in DNS format. The character string can be converted into an associative array of elements using the PHP unpack() function. Note that this argument is passed by reference and any existing value will be overwritten.

Return Values

This function returns an integer response code. GETDNS_RETURN_GOOD indicates successful completion.

getdns Functions
PHP Manual