diff --git a/src/Sendloop/SendloopAPI3.php b/src/Sendloop/SendloopAPI3.php index 00cc74e..1ae4322 100644 --- a/src/Sendloop/SendloopAPI3.php +++ b/src/Sendloop/SendloopAPI3.php @@ -22,13 +22,11 @@ public function __construct($APIKey,$Subdomain,$ResponseFormat='json') { $this->SetResponseFormat($ResponseFormat); if (empty($APIKey)) { - echo 'APIKey is empty'; return false; } $this->APIKey = $APIKey; if (empty($Subdomain)) { - echo 'Subdomain is empty'; return false; } $this->Subdomain = $Subdomain; @@ -55,11 +53,7 @@ public function run($APICommand,$Parameters) { $APIURL = $this->MakeURL($APICommand); - $ParametersArray = array('APIKey='.$this->APIKey); - foreach ($Parameters as $Key => $Value) { - $ParametersArray[] = "$Key=$Value"; - } - $ParametersString = implode('&',$ParametersArray); + $ParametersString = http_build_query($Parameters) . "&APIKey=$this->APIKey"; curl_setopt($cURL,CURLOPT_URL,$APIURL); curl_setopt($cURL,CURLOPT_POST,1); @@ -80,4 +74,4 @@ public function run($APICommand,$Parameters) { } -} \ No newline at end of file +}