Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
}

// set proxy
if (!empty($this->config->getProxy())) {
curl_setopt($curl, CURLOPT_PROXY, $this->config->getProxy());
}

if (!empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams));
}
Expand Down
23 changes: 23 additions & 0 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ class Configuration
*/
protected $sslVerification = true;

/**
* The HTTP proxy to tunnel requests through
*/
protected $proxy = '';

/**
* Constructor
*/
Expand Down Expand Up @@ -479,6 +484,24 @@ public function getSSLVerification()
return $this->sslVerification;
}

/**
* Sets HTTP proxy to tunnel the request through
* @param string $proxy
*/
public function setProxy($proxy)
{
$this->proxy = $proxy;
}

/**
* Gets HTTP proxy used to tunnel the request through
* @return string HTTP proxy
*/
public function getProxy()
{
return $this->proxy;
}

/**
* Gets the default configuration instance
*
Expand Down