123数字人回调callback源码!
123数字人回调地址如何写?
回调PHP源码:
<?php
/**
* 回调接收器
* 用于接收任务管理系统的回调通知
* 将接收到的数据保存到 demo.txt 文件中
*/
// 获取请求数据
$input = json_decode(file_get_contents('php://input'), true) ?: $_REQUEST;
// 获取当前时间
$time = date('Y-m-d H:i:s');
// 获取客户端IP
$ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
// 准备记录的数据
$logData = [
'time' => $time,
'ip' => $ip,
'data' => $input
];
// 转换为可读格式
$logContent = "========================================n";
$logContent .= "时间: {$time}n";
$logContent .= "IP: {$ip}n";
$logContent .= "数据内容:n";
$logContent .= json_encode($input, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
$logContent .= "n========================================nn";
// 保存到 demo.txt 文件
file_put_contents(__DIR__ . '/demo.txt', $logContent, FILE_APPEND);
// 返回响应给调用方
$response = [
'code' => 200,
'msg' => '回调接收成功',
'time' => $time
];
echo json_encode($response, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
?>来源:酷虎123数字人

沪ICP备14003863号
贵公网安备 52010202003147号