@@ -20,9 +20,6 @@ public static function send($msg_count, $email_to, $webhook_token) {
20
20
self ::delete_webhook ($ webhook_token );
21
21
// Get the chat ID
22
22
$ chatId = self ::get_chat_id ($ webhook_token );
23
- // var_dump($chatId);
24
- // print_r('chatId response: ');
25
- // print_r($chatId);
26
23
if (!empty ($ chatId )) {
27
24
$ text = "You have received: $ msg_count unread email.s \nTo: $ email_to " ;
28
25
$ curl_handle = Hm_Functions::c_init ();
@@ -61,9 +58,7 @@ public static function get_chat_id($webhook_token) {
61
58
62
59
curl_close ($ ch );
63
60
if (trim ($ curl_result )) {
64
- $ response_data = json_decode ($ curl_result , true );
65
- file_put_contents ('./debug.log ' , 'Raw cURL result: ' . $ response_data ['result ' ] . "\n" , FILE_APPEND );
66
-
61
+ $ response_data = json_decode ($ curl_result , true );
67
62
// Log the decoded response data for debugging
68
63
if (isset ($ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ]) && !empty ($ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ])) {
69
64
$ chatId = $ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ];
@@ -73,35 +68,6 @@ public static function get_chat_id($webhook_token) {
73
68
return '' ;
74
69
}
75
70
}
76
-
77
-
78
-
79
-
80
-
81
- // $curl_handle = Hm_Functions::c_init();
82
- // Hm_Functions::c_setopt($curl_handle, CURLOPT_URL, static::PREFIX_URI . 'bot' . $webhook_token . '/getUpdates');
83
- // Hm_Functions::c_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
84
- // $curl_result = Hm_Functions::c_exec($curl_handle);
85
- // file_put_contents('./debug.log', 'Raw cURL result: ' . $curl_result . "\n", FILE_APPEND);
86
-
87
- // if ($curl_result === false) {
88
- // // Hm_Msgs::add('cURL Error: ' . Hm_Functions::c_error($curl_handle) . '<br>');
89
- // // Hm_Functions::c_close($curl_handle);
90
- // return '';
91
- // }
92
-
93
- // // Hm_Functions::c_close($curl_handle);
94
-
95
- // if (trim($curl_result)) {
96
- // $response_data = json_decode($curl_result, true);
97
- // if (isset($response_data['result'][0]['message']['chat']['id']) && !empty($response_data['result'][0]['message']['chat']['id'])) {
98
- // $chatId = $response_data['result'][0]['message']['chat']['id'];
99
- // return $chatId;
100
- // } else {
101
- // Hm_Msgs::add('ERRNo messages found. Please send a message to your bot first.<br>');
102
- // return '';
103
- // }
104
- // }
105
71
}
106
72
107
73
/**
0 commit comments