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