diff --git a/src/KavenegarApi.php b/src/KavenegarApi.php
index 24d8fe7..ff0e946 100644
--- a/src/KavenegarApi.php
+++ b/src/KavenegarApi.php
@@ -10,10 +10,9 @@
 
 class KavenegarApi
 {
-    protected $apiKey;
-    const APIPATH = "https://api.kavenegar.com/v1/%s/%s/%s.json/";
-    const VERSION = "1.1.0";
-    public function __construct($apiKey)
+    const APIPATH = "%s://api.kavenegar.com/v1/%s/%s/%s.json/";
+    const VERSION = "1.2.2";
+    public function __construct($apiKey,$insecure=false)
     {
         if (!extension_loaded('curl')) {
             die('cURL library is not loaded');
@@ -23,12 +22,13 @@ public function __construct($apiKey)
             die('apiKey is empty');
             exit;
         }
-        $this->apiKey = $apiKey;
+        $this->apiKey = trim($apiKey);
+        $this->insecure = $insecure;
     }   
     
 	protected function get_path($method, $base = 'sms')
     {
-        return sprintf(self::APIPATH, $this->apiKey, $base, $method);
+        return sprintf(self::APIPATH,$this->insecure==true ? "http": "https", $this->apiKey, $base, $method);
     }
 	
 	protected function execute($url, $data = null)