mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-05-15 06:01:06 +00:00
Update index.php
This commit is contained in:
parent
ff381b8e3e
commit
09ac94bf00
|
@ -6,10 +6,10 @@
|
||||||
* Namhyeon Go (Catswords Research) <abuse@catswords.net>
|
* Namhyeon Go (Catswords Research) <abuse@catswords.net>
|
||||||
* https://github.com/gnh1201/caterpillar
|
* https://github.com/gnh1201/caterpillar
|
||||||
* Created at: 2022-10-06
|
* Created at: 2022-10-06
|
||||||
* Updated at: 2024-10-25
|
* Updated at: 2024-11-08
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("PHP_HTTPPROXY_VERSION", "0.1.6.2");
|
define("PHP_HTTPPROXY_VERSION", "0.1.6.3-dev");
|
||||||
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);
|
||||||
|
@ -489,6 +489,23 @@ function relay_invoke_method($params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function relay_web_search($params) {
|
||||||
|
$result = relay_fetch_url(array(
|
||||||
|
"url" => "https://serp.catswords.net/api.php?" . http_build_query($params);
|
||||||
|
));
|
||||||
|
if ($result['success']) {
|
||||||
|
return array(
|
||||||
|
"success" => true,
|
||||||
|
"result" => array(
|
||||||
|
"status" => 200,
|
||||||
|
"data" => json_decode($result['result']['data'], true)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function get_client_address() {
|
function get_client_address() {
|
||||||
$client_address = '';
|
$client_address = '';
|
||||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||||
|
@ -591,6 +608,15 @@ if ($context['jsonrpc'] == "2.0") {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "relay_web_search":
|
||||||
|
$result = relay_web_search($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