@@ -20,9 +20,6 @@ public static function send($msg_count, $email_to, $webhook_token) {
2020 self ::delete_webhook ($ webhook_token );
2121 // Get the chat ID
2222 $ chatId = self ::get_chat_id ($ webhook_token );
23- // var_dump($chatId);
24- // print_r('chatId response: ');
25- // print_r($chatId);
2623 if (!empty ($ chatId )) {
2724 $ text = "You have received: $ msg_count unread email.s \nTo: $ email_to " ;
2825 $ curl_handle = Hm_Functions::c_init ();
@@ -61,9 +58,7 @@ public static function get_chat_id($webhook_token) {
6158
6259 curl_close ($ ch );
6360 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 );
6762 // Log the decoded response data for debugging
6863 if (isset ($ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ]) && !empty ($ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ])) {
6964 $ chatId = $ response_data ['result ' ][0 ]['message ' ]['chat ' ]['id ' ];
@@ -73,35 +68,6 @@ public static function get_chat_id($webhook_token) {
7368 return '' ;
7469 }
7570 }
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- // }
10571 }
10672
10773 /**
0 commit comments