github/public/tests/hook.php
2025-04-12 19:11:43 +08:00

128 lines
2.4 KiB
PHP

<?php
include("include/head.php");
include("../../src/Services/TomTool/Http.php");
//include("../../config/.config.php");
//use App\Services\TomTool\Http;
$oHttp = new App\Services\TomTool\Http();
$oHttp->sMethod = "post";
$oHttp->sToUrl = "https://github.loc/api/tg/hook";
$oHttp->bIsJson = true;
$oHttp->aData = [
'update_id' => 123456789,
'message' => [
'message_id' => 1,
'from' => [
'id' => 7740568271,
'is_bot' => false,
'first_name' => 'John',
'last_name' => 'Doe',
'username' => 'johndoe',
'language_code' => 'en'
],
'chat' => [
'id' => -4668400285,
'first_name' => 'John',
'last_name' => 'Doe',
'username' => 'johndoe',
'type' => 'private'
],
'date' => 1610000000,
"text" => "\/ry 你好,网站是正常运行的。用不了一般是没配置对,调试调试。",
]
];
//{
// "update_id": 761180998,
// "message": {
// "message_id": 1159,
// "from": {
// "id": 7740568271,
// "is_bot": false,
// "first_name": "sakai",
// "username": "gemcode_business",
// "language_code": "zh-hans"
// },
// "chat": {
// "id": -4668400285,
// "title": "FUUU",
// "type": "group",
// "all_members_are_administrators": true
// },
// "date": 1743503707,
// "text": "\/userFind 1",
// "entities": [
// {
// "offset": 0,
// "length": 9,
// "type": "bot_command"
// }
// ]
// }
//}
$r = $oHttp->send();
echo($r);
exit;
$url = 'https://fuc.loc/api/tg/hook';
$url = 'https://fuc.loc/test3';
$data = [
'message' => [
'chat' => [
'id' => '-4668400285'
],
'text' => '/reply 11 sss'
]
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
die('Error');
}
echo $result;
exit;
?>