class SessionClient extends Client (View source)

CNR Session API Client

Properties

protected array<string, mixed> $context

context data for the client

from  Client
mixed[] $settings

registrar api settings

from  Client
protected string $socketURL

API connection url

from  Client
protected SocketConfig $socketConfig

Object covering API connection data

from  Client
protected bool $debugMode

activity flag for debug mode

from  Client
protected string $ua

user agent

from  Client
protected string[] $curlopts

additional curl options to use

from  Client
protected LoggerInterface $logger

logger function name for debug mode

from  Client
bool $isOTE

is connected to OT&E

from  Client
protected CurlHandle|null $chandle

curl handle cache

from  Client

Methods

__construct()

Constructor

$this
setCustomLogger(LoggerInterface $customLogger)

set custom logger to use instead of default one create your own class implementing \CNIC\LoggerInterface

from  Client
$this
setDefaultLogger()

set default logger to use

from  Client
$this
enableDebugMode()

Enable Debug Output to STDOUT

from  Client
$this
disableDebugMode()

Disable Debug Output

from  Client
string
getPOSTData(array $cmd, bool $secured = false)

Serialize given command for POST request including connection configuration data

from  Client
string|null
getSession()

Get the API Session ID that is currently set

from  Client
string
getURL()

Get the API connection url that is currently set

from  Client
$this
setUserAgent(string $str, string $rv, array $modules = [])

Set a custom user agent (for platforms that use this SDK)

from  Client
string
getUserAgent()

Get the user agent string

from  Client
$this
setProxy(string $proxy = "")

Set proxy to use for API communication

from  Client
string|null
getProxy()

Get proxy configuration for API communication

from  Client
$this
setReferer(string $referer = "")

Set Referer to use for API communication

from  Client
string|null
getReferer()

Get Referer configuration for API communication

from  Client
string
getVersion()

Get the current module version

from  Client
$this
setURL(string $value)

Set another connection url to be used for API communication

from  Client
$this
setSession(string $value = "")

Set an API session id to be used for API communication

from  Client
$this
setRemoteIPAddress(string $value = "")

Set an Remote IP Address to be used for API communication To be used in case you have an active ip filter setting.

from  Client
$this
setCredentials(string $uid = "", string $pw = "")

Set Credentials to be used for API communication

from  Client
$this
setRoleCredentials(string $uid = "", string $role = "", string $pw = "")

Set Credentials to be used for API communication

from  Client
array
IDNConvert(array $domains)

Convert domain names to idn + punycode if necessary

from  Client
array
autoIDNConvert(array $cmd)

Auto convert API command parameters to punycode, if necessary.

from  Client
request(array $cmd = [])

Perform API request using the given command

from  Client
Response|null
requestNextResponsePage(Response $rr)

Request the next page of list entries for the current list query Useful for tables

from  Client
array
requestAllResponsePages(array $cmd)

Request all pages/entries for the given query command

from  Client
void
close()

Close all curl handles

from  Client
$this
setUserView(string $uid = "")

Set a data view to a given subuser

from  Client
$this
useHighPerformanceConnectionSetup()

Activate High Performance Setup

from  Client
$this
useOTESystem()

Set OT&E System for API communication

from  Client
$this
useLIVESystem()

Set LIVE System for API communication (this is the default setting)

from  Client
$this
setContext(array $context)

Set context data for the client (to be used in a custom logger to access additional data at logging time again) The use of this context data is optional and has no impact on the SDK behaviour itself.

from  Client
login()

Perform API login to start session-based communication

logout()

Perform API logout to close API session in use

$this
saveSession(array $session)

Apply session data (session id, login) to given php session object

$this
reuseSession(array $session)

Use existing configuration out of php session object to rebuild and reuse connection settings

Details

__construct()

Constructor

Exceptions

Exception

$this setCustomLogger(LoggerInterface $customLogger)

set custom logger to use instead of default one create your own class implementing \CNIC\LoggerInterface

Parameters

LoggerInterface $customLogger

Return Value

$this

$this setDefaultLogger()

set default logger to use

Return Value

$this

$this enableDebugMode()

Enable Debug Output to STDOUT

Return Value

$this

$this disableDebugMode()

Disable Debug Output

Return Value

$this

string getPOSTData(array $cmd, bool $secured = false)

Serialize given command for POST request including connection configuration data

Parameters

array $cmd

API command to encode

bool $secured

secure password (when used for output)

Return Value

string

string|null getSession()

Get the API Session ID that is currently set

Return Value

string|null

string getURL()

Get the API connection url that is currently set

Return Value

string

$this setUserAgent(string $str, string $rv, array $modules = [])

Set a custom user agent (for platforms that use this SDK)

Parameters

string $str

user agent label

string $rv

user agent revision

array $modules

further modules to add to user agent string, format: ["/", "/", ... ]

Return Value

$this

string getUserAgent()

Get the user agent string

Return Value

string

$this setProxy(string $proxy = "")

Set proxy to use for API communication

Parameters

string $proxy

proxy to use (optional, for reset)

Return Value

$this

string|null getProxy()

Get proxy configuration for API communication

Return Value

string|null

$this setReferer(string $referer = "")

Set Referer to use for API communication

Parameters

string $referer

Referer (optional, for reset)

Return Value

$this

string|null getReferer()

Get Referer configuration for API communication

Return Value

string|null

string getVersion()

Get the current module version

Return Value

string

$this setURL(string $value)

Set another connection url to be used for API communication

Parameters

string $value

API connection url to set

Return Value

$this

$this setSession(string $value = "")

Set an API session id to be used for API communication

Parameters

string $value

API session id (optional, for reset)

Return Value

$this

$this setRemoteIPAddress(string $value = "")

Set an Remote IP Address to be used for API communication To be used in case you have an active ip filter setting.

Parameters

string $value

Remote IP Address (optional, for reset)

Return Value

$this

Exceptions

Exception

$this setCredentials(string $uid = "", string $pw = "")

Set Credentials to be used for API communication

Parameters

string $uid

account name (optional, for reset)

string $pw

account password (optional, for reset)

Return Value

$this

$this setRoleCredentials(string $uid = "", string $role = "", string $pw = "")

Set Credentials to be used for API communication

Parameters

string $uid

account name (optional, for reset)

string $role

role user id (optional, for reset)

string $pw

role user password (optional, for reset)

Return Value

$this

array IDNConvert(array $domains)

Convert domain names to idn + punycode if necessary

Parameters

array $domains

list of domain names (or tlds)

Return Value

array

protected array autoIDNConvert(array $cmd)

Auto convert API command parameters to punycode, if necessary.

Parameters

array $cmd

API command

Return Value

array

Response request(array $cmd = [])

Perform API request using the given command

Parameters

array $cmd

API command to request (optional for session login)

Return Value

Response

Response|null requestNextResponsePage(Response $rr)

Request the next page of list entries for the current list query Useful for tables

Parameters

Response $rr

API Response of current page

Return Value

Response|null

Exceptions

Exception

array requestAllResponsePages(array $cmd)

Request all pages/entries for the given query command

Parameters

array $cmd

API list command to use

Return Value

array

void close()

Close all curl handles

Return Value

void

$this setUserView(string $uid = "")

Set a data view to a given subuser

Parameters

string $uid

subuser account name

Return Value

$this

$this useHighPerformanceConnectionSetup()

Activate High Performance Setup

Return Value

$this

$this useOTESystem()

Set OT&E System for API communication

Return Value

$this

$this useLIVESystem()

Set LIVE System for API communication (this is the default setting)

Return Value

$this

$this setContext(array $context)

Set context data for the client (to be used in a custom logger to access additional data at logging time again) The use of this context data is optional and has no impact on the SDK behaviour itself.

Will be forwarded either to the logger or to the Response object

Parameters

array $context

Return Value

$this

Response login()

Perform API login to start session-based communication

Return Value

Response

Response logout()

Perform API logout to close API session in use

Return Value

Response

$this saveSession(array $session)

Apply session data (session id, login) to given php session object

Parameters

array $session

php session instance ($_SESSION)

Return Value

$this

$this reuseSession(array $session)

Use existing configuration out of php session object to rebuild and reuse connection settings

Parameters

array $session

php session object ($_SESSION)

Return Value

$this