diff --git a/src/HTTPHandler/HTTPHandler.php b/src/HTTPHandler/HTTPHandler.php index a42365b..e4e033e 100644 --- a/src/HTTPHandler/HTTPHandler.php +++ b/src/HTTPHandler/HTTPHandler.php @@ -14,7 +14,7 @@ class HTTPHandler { /** @var string The SmartAPI Helper version */ - private const SMARTAPI_HELPER_VERSION = '1.0.0'; + private $smartapi_helper_version = ''; /** @var string User's login name */ private $user_login; /** @var string User's password */ @@ -52,6 +52,8 @@ public function __construct() { //Initialize cURL resource $this->ch = curl_init(); + //Get the SmartAPI library version + $this->smartapi_helper_version = file_get_contents(__DIR__ . '/../VERSION.config'); } /** @@ -209,7 +211,7 @@ public function curlPrep(): void //Set user agent $curl_agent = 'cURL/' . curl_version()['version']; $php_agent = 'PHP/' . PHP_VERSION; - $smartapi_helper_agent = 'SmartAPIHelper/' . self::SMARTAPI_HELPER_VERSION; + $smartapi_helper_agent = 'SmartAPIHelper/' . $this->smartapi_helper_version; $full_agent = $smartapi_helper_agent . ' ' . $curl_agent . ' ' . $php_agent; curl_setopt($this->ch, CURLOPT_USERAGENT, $full_agent); diff --git a/src/VERSION.config b/src/VERSION.config new file mode 100644 index 0000000..e6d5cb8 --- /dev/null +++ b/src/VERSION.config @@ -0,0 +1 @@ +1.0.2 \ No newline at end of file