X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e42ff1935f05c6e0eb5db77d264e7c923186deb2..fb7d65b8c377fd5c9a74fef1ef800c9bc8e2abc3:/lib/init-cmd.php?ds=sidebyside diff --git a/lib/init-cmd.php b/lib/init-cmd.php index e6de0522..e5a650fc 100644 --- a/lib/init-cmd.php +++ b/lib/init-cmd.php @@ -6,3 +6,26 @@ require_once('init.php'); require_once('cmd.php'); + + // handle http proxy when using file_get_contents + if (CONST_HTTP_Proxy) { + $proxy = '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 != '') { + $auth = base64_encode(CONST_HTTP_Proxy_Login . ':' . CONST_HTTP_Proxy_Password); + $aHeaders = array("Proxy-Authorization: Basic $auth"); + } + $aContext = array( + 'http' => array( + 'proxy' => $proxy, + 'request_fulluri' => true, + 'header' => $aHeaders + ), + 'https' => array( + 'proxy' => $proxy, + 'request_fulluri' => true, + 'header' => $aHeaders + ) + ); + stream_context_set_default($aContext); + }