<?php
$ch = curl_init('http://localhost/shop/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__ . '/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ . '/cookie.txt');
$res = curl_exec($ch);
preg_match('/name="csrf_token" value="([^"]+)"/', $res, $m);
$csrf = $m[1] ?? '';

curl_setopt($ch, CURLOPT_URL, 'http://localhost/shop/login');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['csrf_token' => $csrf, 'username' => 'seller', 'password' => 'Seller@123']));
curl_exec($ch);

$testCatIds = [4, 16, 17, 8, 20, 22];
foreach ($testCatIds as $cid) {
    curl_setopt($ch, CURLOPT_URL, 'http://localhost/shop/seller/products/category-sizes/' . $cid);
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    echo "Category ID {$cid} Response:\n" . curl_exec($ch) . "\n\n";
}
