Client
class Client (View source)
CNR API Client
Properties
| protected array<string, mixed> | $context | context data for the client |
|
| mixed[] | $settings | registrar api settings |
|
| protected string | $socketURL | API connection url |
|
| protected SocketConfig | $socketConfig | Object covering API connection data |
|
| protected bool | $debugMode | activity flag for debug mode |
|
| protected string | $ua | user agent |
|
| protected string[] | $curlopts | additional curl options to use |
|
| protected LoggerInterface | $logger | logger function name for debug mode |
|
| bool | $isOTE | is connected to OT&E |
|
| protected CurlHandle|null | $chandle | curl handle cache |
Methods
Constructor
set custom logger to use instead of default one create your own class implementing \CNIC\LoggerInterface
set default logger to use
Enable Debug Output to STDOUT
Disable Debug Output
Serialize given command for POST request including connection configuration data
Get the API Session ID that is currently set
Get the API connection url that is currently set
Set a custom user agent (for platforms that use this SDK)
Get the user agent string
Set proxy to use for API communication
Get proxy configuration for API communication
Set Referer to use for API communication
Get Referer configuration for API communication
Get the current module version
Set another connection url to be used for API communication
Set an API session id to be used for API communication
Set an Remote IP Address to be used for API communication To be used in case you have an active ip filter setting.
Set Credentials to be used for API communication
Set Credentials to be used for API communication
Convert domain names to idn + punycode if necessary
Auto convert API command parameters to punycode, if necessary.
Request the next page of list entries for the current list query Useful for tables
Request all pages/entries for the given query command
Close all curl handles
Set a data view to a given subuser
Activate High Performance Setup
Set OT&E System for API communication
Set LIVE System for API communication (this is the default setting)
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.
Details
__construct(string $path = "")
Constructor
$this
setCustomLogger(LoggerInterface $customLogger)
set custom logger to use instead of default one create your own class implementing \CNIC\LoggerInterface
$this
setDefaultLogger()
set default logger to use
$this
enableDebugMode()
Enable Debug Output to STDOUT
$this
disableDebugMode()
Disable Debug Output
string
getPOSTData(array $cmd, bool $secured = false)
Serialize given command for POST request including connection configuration data
string|null
getSession()
Get the API Session ID that is currently set
string
getURL()
Get the API connection url that is currently set
$this
setUserAgent(string $str, string $rv, array $modules = [])
Set a custom user agent (for platforms that use this SDK)
string
getUserAgent()
Get the user agent string
$this
setProxy(string $proxy = "")
Set proxy to use for API communication
string|null
getProxy()
Get proxy configuration for API communication
$this
setReferer(string $referer = "")
Set Referer to use for API communication
string|null
getReferer()
Get Referer configuration for API communication
string
getVersion()
Get the current module version
$this
setURL(string $value)
Set another connection url to be used for API communication
$this
setSession(string $value = "")
Set an API session id to be used for API communication
$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.
$this
setCredentials(string $uid = "", string $pw = "")
Set Credentials to be used for API communication
$this
setRoleCredentials(string $uid = "", string $role = "", string $pw = "")
Set Credentials to be used for API communication
array
IDNConvert(array $domains)
Convert domain names to idn + punycode if necessary
protected array
autoIDNConvert(array $cmd)
Auto convert API command parameters to punycode, if necessary.
Response
request(array $cmd = [])
Perform API request using the given command
Response|null
requestNextResponsePage(Response $rr)
Request the next page of list entries for the current list query Useful for tables
array
requestAllResponsePages(array $cmd)
Request all pages/entries for the given query command
void
close()
Close all curl handles
$this
setUserView(string $uid = "")
Set a data view to a given subuser
$this
useHighPerformanceConnectionSetup()
Activate High Performance Setup
$this
useOTESystem()
Set OT&E System for API communication
$this
useLIVESystem()
Set LIVE System for API communication (this is the default setting)
$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