getdns Functions
PHP Manual

php_getdns_context_create

(PECL getdns >= 0.10.0)

php_getdns_context_createCreate a new DNS context.

Description

int php_getdns_context_create ( int &$context , bool $setFromOS )

Calls to getdns functions require a DNS context, which is a group of API settings that affect how DNS calls are made. For most applications, a default context is sufficient.

Parameters

context

The variable to receive the created context. Note that this argument is passed by reference and any existing value will be overwritten. The context must be freed using php_getdns_context_destroy().

setFromOS

This variable describes how certain default context values are determined. Most applications will want setFromOS set to 1. When the context is used in the API for the first time and setFromOS is 1, the API starts replacing some of the values with values from the operating system, such as those that would be found in res_query(3), /etc/resolv.conf, and so on, then proceeds with the new function. Some advanced users will not want the API to change the values to the OS's defaults; if setFromOS is 0, the API will not do any updates to the initial values based on changes in the OS. For example, this might be useful if the API is acting as a stub resolver that is using a specific upstream recursive resolver chosen by the application, not the one that might come back from DHCP.

Return Values

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

The call to php_getdns_context_create() immediately returns a context that can be used with other API calls; that context contains the API's default values.


getdns Functions
PHP Manual