mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-03-11 00:15:16 +00:00
Update index.php
This commit is contained in:
parent
0d7200012f
commit
c38319dcaf
|
@ -9,7 +9,7 @@
|
||||||
* Updated at: 2024-06-19
|
* Updated at: 2024-06-19
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("PHP_HTTPPROXY_VERSION", "0.1.5.15");
|
define("PHP_HTTPPROXY_VERSION", "0.1.5.16");
|
||||||
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
||||||
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
||||||
define("MAX_EXECUTION_TIME", 0);
|
define("MAX_EXECUTION_TIME", 0);
|
||||||
|
@ -373,6 +373,30 @@ function relay_get_geolocation() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function relay_call_user_func($params) {
|
||||||
|
$callback = $params['callback'];
|
||||||
|
$args = (is_array($params['args']) ? $params['args'] : array());
|
||||||
|
|
||||||
|
try {
|
||||||
|
return array(
|
||||||
|
"success" => true,
|
||||||
|
"result" => array(
|
||||||
|
"status" => 200,
|
||||||
|
"data" => call_user_func_array($callback, $args)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => array(
|
||||||
|
"status" => 503,
|
||||||
|
"code" => -1,
|
||||||
|
"message" => $e->__toString()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function get_client_address() {
|
function get_client_address() {
|
||||||
$client_address = '';
|
$client_address = '';
|
||||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
@ -454,6 +478,15 @@ if ($context['jsonrpc'] == "2.0") {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "relay_call_user_func":
|
||||||
|
$result = relay_call_user_func($context['params']);
|
||||||
|
if ($result['success']) {
|
||||||
|
echo jsonrpc2_result_encode($result['result'], $context['id']);
|
||||||
|
} else {
|
||||||
|
echo jsonrpc2_error_encode($result['error'], $context['id']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "get_client_address":
|
case "get_client_address":
|
||||||
echo jsonrpc2_result_encode(get_client_address(), $context['id']);
|
echo jsonrpc2_result_encode(get_client_address(), $context['id']);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user