3 * Common parameter parsing for benchmarks and tests scripts
6 * @param string LOCALSERVER
8 * @param string HTTPSSERVER
9 * @param string HTTPSSURI
12 * @copyright (C) 2007-20013 G. Giunta
13 * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
16 require_once('xmlrpc.inc');
17 require_once('xmlrpcs.inc');
19 // play nice to older PHP versions that miss superglobals
22 $_SERVER = $HTTP_SERVER_VARS;
23 $_GET = isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : array();
24 $_POST = isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : array();
27 // check for command line vs web page input params
28 if(!isset($_SERVER['REQUEST_METHOD']))
32 foreach($argv as $param)
34 $param = explode('=', $param);
42 elseif(!ini_get('register_globals'))
44 // play nice to 'safe' PHP installations with register globals OFF
45 // NB: we might as well consider using $_GET stuff later on...
56 $DEBUG = intval($DEBUG);
59 if(!isset($LOCALSERVER))
63 $LOCALSERVER = $HTTP_HOST;
65 elseif(isset($_SERVER['HTTP_HOST']))
67 $LOCALSERVER = $_SERVER['HTTP_HOST'];
71 $LOCALSERVER = 'localhost';
74 if(!isset($HTTPSSERVER))
76 $HTTPSSERVER = 'xmlrpc.usefulinc.com';
80 $HTTPSURI = '/server.php';
82 if(!isset($HTTPSIGNOREPEER))
84 $HTTPSIGNOREPEER = false;
92 $arr = explode(':',$PROXY);
93 $PROXYSERVER = $arr[0];
103 // used to silence testsuite warnings about proxy code not being tested
110 // GUESTIMATE the url of local demo server
111 // play nice to php 3 and 4-5 in retrieving URL of server.php
112 /// @todo filter out query string from REQUEST_URI
113 if(isset($REQUEST_URI))
115 $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
116 $URI = str_replace('/testsuite.php', '/server.php', $URI);
117 $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
118 $URI = str_replace('/benchmark.php', '/server.php', $URI);
120 elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD']))
122 $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
123 $URI = str_replace('/testsuite.php', '/server.php', $URI);
124 $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
125 $URI = str_replace('/benchmark.php', '/server.php', $URI);
129 $URI = '/demo/server/server.php';
136 if(!isset($LOCALPATH))
138 $LOCALPATH = dirname(__FILE__);