Hi there, im new for ExeOutput for PHP.
My code use curl for send request but its not working for me.
This is my code:
function send_to_telegram($bot_token, $chat_id, $message) {
$url = "https://api.telegram.org/bot$bot_token/sendMessage";
$data = [
'chat_id' => $chat_id,
'text' => $message,
'parse_mode' => 'MarkdownV2'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . "/cacert.pem"); // Thiết lập đường dẫn đến tệp cacert.pem
$response = curl_exec($ch);
if (curl_errno($ch)) {
// Hiển thị lỗi cURL
echo 'cURL error: ' . curl_error($ch);
} else {
// Hiển thị phản hồi từ API Telegram
echo 'Response: ' . $response;
}
curl_close($ch);
return $response;
}
although i put cacert.pem in same directory project.
my php setting in ExeOutput
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
Anyone please help me. thanks