<?php
$url = 'http://localhost/yangquan_wedding/api/api_router.php?path=video/upload';
$videoFile = 'videos/opening/6月18日 (5).mp4';

if (!file_exists($videoFile)) {
    echo "测试文件不存在\n";
    exit;
}

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);

$postData = [
    'video' => new CURLFile($videoFile),
    'video_type' => 'host',
    'video_name' => '测试主持视频'
];

curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "HTTP状态码: $httpCode\n";
echo "上传响应:\n";
echo $response;
echo "\n";
?>