--- a/Libraries/PrestaShopWebService.php
+++ b/Libraries/PrestaShopWebService.php
@@ -46,9 +46,11 @@
 	/** @var string PS version */
 	protected $version;
 
+	public $contentdebug;
+
 	/** @var array compatible versions of PrestaShop Webservice */
 	const psCompatibleVersionsMin = '1.4.0.0';
-	const psCompatibleVersionsMax = '1.6.99.99';
+	const psCompatibleVersionsMax = '1.7.99.99';
 
 	/**
 	 * PrestaShopWebService constructor. Throw an exception when CURL is not installed/activated
@@ -112,8 +114,10 @@
 			CURLINFO_HEADER_OUT => TRUE,
 			CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
 			CURLOPT_USERPWD => $this->key.':',
-			CURLOPT_HTTPHEADER => array( 'Expect:' )
-		);
+			CURLOPT_HTTPHEADER => array( 'Expect:','content-type:text/xml' ),
+			CURLOPT_SSL_VERIFYHOST => 0,
+			CURLOPT_SSL_VERIFYPEER => 0
+        );
 
 		$session = curl_init($url);
 
@@ -182,7 +186,7 @@
 
 	public function printDebug($title, $content)
 	{
-		echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
+		$this->contentdebug=$title."\r\n".$content."\r\n\r\n";
 	}
 
 	public function getVersion()
@@ -201,6 +205,7 @@
 		{
 			libxml_clear_errors();
 			libxml_use_internal_errors(true);
+			$response = preg_replace('/^\h*\v+/m', '', $response);
 			$xml = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
 			if (libxml_get_errors())
 			{
@@ -241,7 +246,7 @@
 		$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
 
 		self::checkStatusCode($request['status_code']);
-		return self::parseXML($request['response']);
+		return self::parseXML(trim($request['response']));
 	}
 
 	/**
@@ -359,7 +364,7 @@
 
 		$request = self::executeRequest($url,  array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
 		self::checkStatusCode($request['status_code']);// check the response validity
-		return self::parseXML($request['response']);
+		return self::parseXML(trim($request['response']));
 	}
 
 	/**
