function mobi_parse_requrest()
{
global $request_method, $request_params, $params_num;
$ver = phpversion();
if ($ver[0] >= 5) {
$data = file_get_contents('php://input');
} else {
$data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
}
if (count($_SERVER) == 0) {
$r = new xmlrpcresp('', 15, 'XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
echo $r->serialize('UTF-8');
exit;
}
if (isset($_SERVER['HTTP_CONTENT_ENCODING'])) {
$content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
} else {
$content_encoding = '';
}
if ($content_encoding != '' && strlen($data)) {
if ($content_encoding == 'deflate' || $content_encoding == 'gzip') {
// if decoding works, use it. else assume data wasn't gzencoded
if (function_exists('gzinflate')) {
if ($content_encoding == 'deflate' && ($degzdata = @gzuncompress($data))) {
$data = $degzdata;
} elseif ($degzdata = @gzinflate(substr($data, 10))) {
$data = $degzdata;
}
} else {
$r = new xmlrpcresp('', 106, 'Received from client compressed HTTP request and cannot decompress');
echo $r->serialize('UTF-8');
exit;
}
}
}
$parsers = php_xmlrpc_decode_xml($data);
$request_method = $parsers->methodname;
$request_params = php_xmlrpc_decode(new xmlrpcval($parsers->params, 'array'));
$params_num = count($request_params);
}