getdns Functions
PHP Manual

php_getdns_service

(PECL getdns >= 0.10.0)

php_getdns_serviceAsynchronously retrieve SRV information given a name.

Description

int php_getdns_service ( int $context , string $name , int $extensions , array $userArg , mixed &$transID )

This function provides an entry point into the getdns API library to asynchronously retrieve SRV information given a name. See php_getdns_service_sync() for a description of the response data structure.

Note that this function enqueues an event that must be processed to produce queries and return results. Calling php_context_run() after calling this function will ensure that all queued events are processed.

Parameters

context

The previously created DNS context that is to be used with this request.

name

The service name to resolve.

extensions

The extensions dictionary for this request; NULL or 0 (zero) if no extensions.

userArg

An indexed array that contains information used to control callback processing. The first element of the array must contain a character string representing the name of the PHP client function that will receive and process the result of the DNS query. Additional array elements are optional and may be included to be passed to the callback function. The callback function will receive the complete array for local processing with all elements included as specified.

The callback function should be declared as follows:

        function_name($dict, $callbackType, $userArg, $transID)
        // $dict: An int representing the dictionary containing the response.
        // $callbackType: The getdns callback type.
        // $userArg: The original user arguments provided by the caller.
        // $transID: A 16-character string in hex format that contains the identifier of the transaction being processed.
      

transID

A 16-character string value in hexadecimal format representing an unsigned 64-bit integer that is filled in by the function to identify the callback being made. This value is passed by reference and any existing value will be overwritten; an empty string ("") is acceptable on input. It can also be NULL, in which case it is ignored and no value is assigned. The php_getdns_cancel_callback() function uses the transID to determine which callback is to be cancelled.

Return Values

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


getdns Functions
PHP Manual