<?php
// 测试服务器端上传
$url = 'http://17yqhl.cn/test_upload_minimal.php';

echo "测试URL: $url\n\n";

// 测试1: 简单POST请求
echo "=== 测试1: 简单POST请求 ===\n";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['test' => '1']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);

echo "HTTP状态: $httpCode\n";
echo "CURL错误: $error\n";
echo "响应:\n$response\n\n";

// 测试2: 上传文件
echo "=== 测试2: 上传文件 ===\n";
$filePath = 'videos/opening/6a33c14d88a55.mp4';
if (!file_exists($filePath)) {
    echo "测试文件不存在!\n";
    exit;
}

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
$postData = [
    'video' => new CURLFile($filePath, 'video/mp4', 'test.mp4'),
    'video_type' => 'host',
    'video_name' => '测试上传'
];
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);

echo "HTTP状态: $httpCode\n";
echo "CURL错误: $error\n";
echo "响应:\n$response\n";
?>