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:
although i put cacert.pem in same directory project.
my php setting in ExeOutput
Anyone please help me. thanks
My code use curl for send request but its not working for me.
This is my code:
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;
}
my php setting in ExeOutput
Code:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
