// Slack送信関数 function sendSlackMessage($webhook_url, $message) { try { $data = array( 'payload' => json_encode(array( 'text' => $message )) ); $ch = curl_init($webhook_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $result = curl_exec($ch); if ($result === false) { throw new Exception("Slack通知の送信に失敗しました: " . curl_error($ch)); } curl_close($ch); return true; } catch (Exception $e) { error_log("Slack通知エラー: " . $e->getMessage()); return false; } }