post($json); } else { file_put_contents("/xtmp/webhook-raw", "\nno tag : $message\n", FILE_APPEND); } } else { file_put_contents("/xtmp/webhook-raw", "\ninvalid json\n", FILE_APPEND); } echo json_encode(["status" => "OK"]); } function post($json) { //$url = 'http://10.9.10.205:5678/webhook-test/aea7f5ff-f24d-4afe-a52e-8b12d328a3b5'; $url = "http://10.9.10.205:5678/webhook/428e0945-f0fc-4dce-a043-2f789a0cafda"; $jsonData = json_encode($json); // Initialize cURL $ch = curl_init($url); // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Content-Length: ' . strlen($jsonData) ]); // Execute request and capture response $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { $c_msg = 'cURL error: ' . curl_error($ch); } else { $c_msg = 'Response: ' . $response; } file_put_contents("/xtmp/webhook-raw", "\n$c_msg\n", FILE_APPEND); // Close cURL curl_close($ch); } }