SessionClient
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
Constructor
set custom logger to use instead of default one create your own class implementing \CNIC\LoggerInterface
Serialize given command for POST request including connection configuration data
Set a custom user agent (for platforms that use this SDK)
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
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
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.
Apply session data (session id, login) to given php session object
Use existing configuration out of php session object to rebuild and reuse connection settings
Details
__construct()
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
Response
login()
Perform API login to start session-based communication
Response
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