<?php
require_once 'config/database.php';
require_once 'config/auth.php';
require_once 'includes/functions.php';

// Simulate login - replace with actual user ID
$_SESSION['user_id'] = 1; // Assuming user ID 1 is an instructor

$courseId = 1; // Test with course ID 1

$url = "http://localhost/lms/api/modules.php?course_id=$courseId";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . session_id());

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

curl_close($ch);

echo "HTTP Code: $httpCode\n";
echo "Response: $response\n";
?>