SessionClient
class SessionClient extends Client (View source)
CNR Session API Client
Traits
Provides session-based API communication methods.
Constants
| private VERSION |
Current module version. Kept in sync automatically by semantic-release — see .releaserc.json. |
Properties
| protected array<string, mixed> | $context | context data for the client |
from AbstractClient |
| protected string | $socketURL | API connection url |
from AbstractClient |
| protected AbstractSocketConfig | $socketConfig | Object covering API connection data |
from AbstractClient |
| protected bool | $debugMode | activity flag for debug mode |
from AbstractClient |
| protected string | $ua | user agent |
from AbstractClient |
| protected array<int, mixed> | $curlopts | additional curl options to use |
from AbstractClient |
| protected LoggerInterface | $logger | logger instance for debug mode |
from AbstractClient |
| protected bool | $isOTE | is connected to OT&E |
from AbstractClient |
| protected HttpTransport | $transport | HTTP transport layer |
from AbstractClient |
Methods
Serialize given command for POST request including connection configuration data
Set a custom user agent (for platforms that use this SDK)
Set proxy to use for API communication
Set Referer to use for API communication
Set another connection url to be used for API communication
Set an API session id to be used for API communication
Set Credentials to be used for API communication
Set Role Credentials to be used for API communication
Activate High Performance Setup
Convert domain names to idn + punycode if necessary
Auto convert API command parameters to punycode, if necessary.
Delegate cURL execution to the transport layer.
Set LIVE System for API communication (this is the default setting)
Request the next page of list entries for the current list query
Request all pages/entries for the given query command
Apply session data to a PHP session object
Rebuild connection settings from a PHP session object
Details
__construct()
Constructor
in
Client at line 49
ResponseInterface
request(array $cmd = [])
Perform API request using the given command
in
Client at line 28
protected AbstractSocketConfig
newSocketConfig()
Instantiate CNR SocketConfig
in
Client at line 38
AbstractClient
setDefaultLogger()
Set default CNR logger
AbstractClient
setCustomLogger(LoggerInterface $customLogger)
Set custom logger to use instead of the default one.
Create your own class implementing \CNIC\LoggerInterface.
AbstractClient
enableDebugMode()
Enable debug output to STDOUT
AbstractClient
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
AbstractClient
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
AbstractClient
setProxy(string $proxy = "")
Set proxy to use for API communication
string|null
getProxy()
Get proxy configuration for API communication
AbstractClient
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
AbstractClient
setURL(string $value)
Set another connection url to be used for API communication
AbstractClient
setSession(string $value = "")
Set an API session id to be used for API communication
AbstractClient
setCredentials(string $uid = "", string $pw = "")
Set Credentials to be used for API communication
AbstractClient
setRoleCredentials(string $uid = "", string $role = "", string $pw = "")
Set Role Credentials to be used for API communication
AbstractClient
useHighPerformanceConnectionSetup()
Activate High Performance Setup
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.
protected array
executeCurl(string $data, array $cfg, array $extraCurlOpts = [])
Delegate cURL execution to the transport layer.
void
close()
Close all cURL connections
string
getLiveUrl()
Get LIVE system URL
bool
isOTE()
Check whether the client is connected to the OT&E system
AbstractClient
useOTESystem()
Set OT&E System for API communication
AbstractClient
useLIVESystem()
Set LIVE System for API communication (this is the default setting)
AbstractClient
setContext(array $context)
Set context data for the client
in
Client at line 69
Response|null
requestNextResponsePage(Response $rr)
Request the next page of list entries for the current list query
array
requestAllResponsePages(array $cmd)
Request all pages/entries for the given query command
Response
login()
Perform API login to start session-based communication
Response
logout()
Perform API logout to close API session in use
SessionCapable
saveSession(array $session)
Apply session data to a PHP session object
SessionCapable
reuseSession(array $session)
Rebuild connection settings from a PHP session object