diff --git a/class/transport.php b/class/transport.php index 5c64c3f..43378ff 100644 --- a/class/transport.php +++ b/class/transport.php @@ -10,6 +10,15 @@ if (false === defined('CS_REST_CALL_TIMEOUT')) { define('CS_REST_CALL_TIMEOUT', 20); } +if (false === defined('CS_REST_PROXY')) { + define('CS_REST_PROXY', ''); +} +if (false === defined('CS_REST_PROXY_PORT')) { + define('CS_REST_PROXY_PORT', ''); +} +if (false === defined('CS_REST_NO_PROXY')) { + define('CS_REST_NO_PROXY', ''); +} if(!function_exists("CS_REST_TRANSPORT_get_available")) { function CS_REST_TRANSPORT_get_available($requires_ssl, $log) { @@ -164,6 +173,11 @@ function make_call($call_options) { curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); } + // Add proxy settings. + curl_setopt($ch, CURLOPT_PROXY, CS_REST_PROXY); + curl_setopt($ch, CURLOPT_PROXYPORT, CS_REST_PROXY_PORT); + curl_setopt($ch, CURLOPT_NOPROXY, CS_REST_NO_PROXY); + $response = curl_exec($ch); if(!$response && $response !== '') { @@ -349,4 +363,4 @@ function _build_request($call_options, $host, $path, $accept_gzip) { return $request."\n\n"; } } -} \ No newline at end of file +}