130 lines
2.3 KiB
PHP
130 lines
2.3 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 = $_ENV['baseUrl']."/api/tg/hook";
|
|
//$oHttp->sToUrl = 'https://fuc.loc/test3';
|
|
$oHttp->bIsJson = true;
|
|
//$oHttp->aData[]
|
|
$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" => "\/reportWidth",
|
|
]
|
|
];
|
|
|
|
//{
|
|
// "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;
|
|
|
|
?>
|