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);
43 elseif(!ini_get('register_globals'))
45 // play nice to 'safe' PHP installations with register globals OFF
46 // NB: we might as well consider using $_GET stuff later on...
57 $DEBUG = intval($DEBUG);
60 if(!isset($LOCALSERVER))
64 $LOCALSERVER = $HTTP_HOST;
66 elseif(isset($_SERVER['HTTP_HOST']))
68 $LOCALSERVER = $_SERVER['HTTP_HOST'];
72 $LOCALSERVER = 'localhost';
75 if(!isset($HTTPSSERVER))
77 $HTTPSSERVER = 'xmlrpc.usefulinc.com';
81 $HTTPSURI = '/server.php';
83 if(!isset($HTTPSIGNOREPEER))
85 $HTTPSIGNOREPEER = false;
87 if(!isset($HTTPSVERIFYHOST))
91 if(!isset($SSLVERSION))
101 $arr = explode(':',$PROXY);
102 $PROXYSERVER = $arr[0];
105 $PROXYPORT = $arr[1];
112 // used to silence testsuite warnings about proxy code not being tested
119 // GUESTIMATE the url of local demo server
120 // play nice to php 3 and 4-5 in retrieving URL of server.php
121 /// @todo filter out query string from REQUEST_URI
122 if(isset($REQUEST_URI))
124 $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
125 $URI = str_replace('/testsuite.php', '/server.php', $URI);
126 $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
127 $URI = str_replace('/benchmark.php', '/server.php', $URI);
129 elseif(isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD']))
131 $URI = str_replace('/test/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
132 $URI = str_replace('/testsuite.php', '/server.php', $URI);
133 $URI = str_replace('/test/benchmark.php', '/demo/server/server.php', $URI);
134 $URI = str_replace('/benchmark.php', '/server.php', $URI);
138 $URI = '/demo/server/server.php';
145 if(!isset($LOCALPATH))
147 $LOCALPATH = dirname(__FILE__);