Files
html/api/skill-webhook-factory.php
2026-04-12 22:57:03 +02:00

10 lines
604 B
PHP

<?php
header('Content-Type: application/json');
$name = $_GET['name'] ?? $_POST['name'] ?? 'alert';
$target = $_GET['target'] ?? $_POST['target'] ?? '';
$path = "/var/www/html/api/webhook-$name.php";
$code = '<?php header("Content-Type:application/json");$d=json_decode(file_get_contents("php://input"),1);$log="/var/log/webhook-'.$name.'.log";file_put_contents($log,date("c")." ".json_encode($d)."
",FILE_APPEND);echo json_encode(["ok"=>true,"webhook"=>"'.$name.'","received"=>$d]);';
file_put_contents($path, $code);
echo json_encode(['ok'=>true,'webhook'=>"/api/webhook-$name.php",'created'=>$path]);