- $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 (!getSettingBool('HTTP_PROXY')) {
+ return;
+ }
+
+ $sProxy = 'tcp://'.getSetting('HTTP_PROXY_HOST').':'.getSetting('HTTP_PROXY_PROT');
+ $aHeaders = array();
+
+ $sLogin = getSetting('HTTP_PROXY_LOGIN');
+ $sPassword = getSetting('HTTP_PROXY_PASSWORD');
+
+ if ($sLogin && $sPassword) {
+ $sAuth = base64_encode($sLogin.':'.$sPassword);
+ $aHeaders = array('Proxy-Authorization: Basic '.$sAuth);