Skip to content
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "getresponse/getresponse",
"name": "funnyfox777/getresponse-api-php",
"description": "GetResponse API v3 client library.",
"version": "0.0.2",
"homepage": "https://github.com/GetResponse/getresponse-api-php",
"version": "1.0.5",
"homepage": "https://github.com/funnyfox777/getresponse-api-php",
"keywords": ["GetResponse", "api", "email"],
"type": "library",
"license": "MIT",
Expand All @@ -23,4 +23,4 @@
"autoload": {
"files": ["src/GetResponseAPI3.class.php"]
}
}
}
14 changes: 10 additions & 4 deletions src/GetResponseAPI3.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GetResponse

private $api_key;
private $api_url = 'https://api.getresponse.com/v3';
private $api_url_enterprise = 'https://api3.getresponse360.pl/v3';
private $timeout = 8;
public $http_status;

Expand All @@ -34,13 +35,17 @@ class GetResponse
* @param $api_key
* @param null $api_url
*/
public function __construct($api_key, $api_url = null)
public function __construct($api_key, $api_url = null, $enterprise_domain = null)
{
$this->api_key = $api_key;

if (!empty($api_url)) {
$this->api_url = $api_url;
}

if (!empty($enterprise_domain)) {
$this->enterprise_domain = $enterprise_domain;
}
}

/**
Expand Down Expand Up @@ -348,7 +353,7 @@ private function call($api_method = null, $http_method = 'GET', $params = array(
}

$params = json_encode($params);
$url = $this->api_url . '/' . $api_method;
$url = ($this->enterprise_domain ? $this->api_url_enterprise : $this->api_url) . '/' . $api_method;

$options = array(
CURLOPT_URL => $url,
Expand All @@ -363,6 +368,7 @@ private function call($api_method = null, $http_method = 'GET', $params = array(

if (!empty($this->enterprise_domain)) {
$options[CURLOPT_HTTPHEADER][] = 'X-Domain: ' . $this->enterprise_domain;

}

if (!empty($this->app_id)) {
Expand Down Expand Up @@ -403,4 +409,4 @@ private function setParams($params = array())
return http_build_query($result);
}

}
}