]> git.openstreetmap.org Git - nominatim.git/blob - lib/init-cmd.php
Merge remote-tracking branch 'upstream/master' into cmake-port
[nominatim.git] / lib / init-cmd.php
1 <?php
2         require_once('init.php');
3         require_once('cmd.php');
4
5         // handle http proxy when using file_get_contents
6         if (CONST_HTTP_Proxy) {
7           $proxy = 'tcp://' . CONST_HTTP_Proxy_Host . ':' . CONST_HTTP_Proxy_Port;
8           $aHeaders = array();
9           if(CONST_HTTP_Proxy_Login != null && CONST_HTTP_Proxy_Login != '' && CONST_HTTP_Proxy_Password != null && CONST_HTTP_Proxy_Password != '') {
10             $auth = base64_encode(CONST_HTTP_Proxy_Login . ':' . CONST_HTTP_Proxy_Password);
11             $aHeaders = array("Proxy-Authorization: Basic $auth");
12           }
13           $aContext = array(
14             'http' => array(
15               'proxy' => $proxy,
16               'request_fulluri' => true,
17               'header' => $aHeaders
18             ),
19             'https' => array(
20               'proxy' => $proxy,
21               'request_fulluri' => true,
22               'header' => $aHeaders
23             )
24           );
25           stream_context_set_default($aContext);
26         }