mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 01:41:00 +00:00
Update index.php
This commit is contained in:
parent
c2c7e2efdd
commit
bcaa4e76df
|
@ -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-06-20
|
* Updated at: 2024-06-21
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("PHP_HTTPPROXY_VERSION", "0.1.5.18");
|
define("PHP_HTTPPROXY_VERSION", "0.1.5.19");
|
||||||
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);
|
||||||
|
@ -350,37 +350,48 @@ function relay_dns_get_record($params) {
|
||||||
function relay_get_geolocation() {
|
function relay_get_geolocation() {
|
||||||
$url = "https://ipapi.co/json/";
|
$url = "https://ipapi.co/json/";
|
||||||
|
|
||||||
$ch = curl_init();
|
try {
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
$error_code = curl_errno($ch);
|
$error_code = curl_errno($ch);
|
||||||
if ($error_code) {
|
if ($error_code) {
|
||||||
$error_message = curl_error($ch);
|
$error_message = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => array(
|
||||||
|
"status" => 502,
|
||||||
|
"code" => $error_code,
|
||||||
|
"message" => $error_message
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
"success" => true,
|
||||||
|
"result" => array(
|
||||||
|
"status" => 200,
|
||||||
|
"data" => $data
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
return array(
|
return array(
|
||||||
"success" => false,
|
"success" => false,
|
||||||
"error" => array(
|
"error" => array(
|
||||||
"status" => 502,
|
"status" => 503,
|
||||||
"code" => $error_code,
|
"code" => -1,
|
||||||
"message" => $error_message
|
"message" => $e->__toString()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
curl_close($ch);
|
|
||||||
$data = json_decode($response, true);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
"success" => true,
|
|
||||||
"result" => array(
|
|
||||||
"status" => 200,
|
|
||||||
"data" => $data
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function relay_invoke_method($params) {
|
function relay_invoke_method($params) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user