use soap api interface and the latest version
$api = ApiClient::factory(PROTOCOL_SOAP, VERSION_DEFAULT);
use xml api interface and the latest vesion
$api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT);
use json api interface and latest version
$api = ApiClient::factory(PROTOCOL_JSON);
--- public static function factory($protocol = PROTOCOL_DEFAULT, $version = VERSION_DEFAULT)
{
$protocol = strtolower($protocol);
if (empty(self::$instance[$version][$protocol])) {
$class = self::getInterface($version, $protocol);
if ($class) {
self::$instance[$version][$protocol] = new $class($protocol, $version);
} else {
throw new ApiClientException(CLI_ERROR_PROTOCOL_VERSION);
}
}
return self::$instance[$version][$protocol];
}
/** * @param $credentials */ public function login($credentials) { $api = \ApiClient::factory(PROTOCOL_SOAP, VERSION_2011_03_01); $connectId = $credentials['connectid']; $secretKey = $credentials['secretkey']; $api->setConnectId($connectId); $api->setSecretKey($secretKey); $this->_apiClient = $api; }