- $aFDs = array(
- 0 => array('pipe', 'r'),
- 1 => STDOUT,
- 2 => STDERR
- );
- $aPipes = null;
- $hProc = @proc_open($sCmd, $aFDs, $aPipes, null, $aEnv);
- if (!is_resource($hProc)) {
- fail('unable to run command:' . $sCmd);
+ if (!CONST_HTTP_Proxy) {
+ return;
+ }
+
+ $sProxy = 'tcp://'.CONST_HTTP_Proxy_Host.':'.CONST_HTTP_Proxy_Port;
+ $aHeaders = array();
+
+ if (CONST_HTTP_Proxy_Login != null
+ && CONST_HTTP_Proxy_Login != ''
+ && CONST_HTTP_Proxy_Password != null
+ && CONST_HTTP_Proxy_Password != ''
+ ) {
+ $sAuth = base64_encode(CONST_HTTP_Proxy_Login.':'.CONST_HTTP_Proxy_Password);
+ $aHeaders = array('Proxy-Authorization: Basic '.$sAuth);