<?php

$testInvitationId = 11577458; // Replace with dynamic ID from your DB
$apiKey = 'ZBqjDEapGaanAZciBRcrkUszedZqxb'; // Replace with your actual API key

$apiUrl = "https://apiv3.imocha.io/v3/reports/{$testInvitationId}?reportType=3";

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "x-api-key: $apiKey"
]);

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

if ($httpCode === 200) {
//    $result = json_decode($response, true);
//    $pdfUrl = $result['pdfReport'];

    print_r($response);
} else {
    echo "Failed to get report. HTTP Code: $httpCode<br>";
    echo "Response: $response";
}
?>