'Invalid ID'])); } $opts = [ "http" => [ "method" => "GET", "header" => "X-Api-Key: $apiKey\r\nContent-Type: application/json\r\n" ] ]; $context = stream_context_create($opts); $response = @file_get_contents($crmBaseUrl . $id, false, $context); if ($response === false) { http_response_code(404); echo json_encode(['error' => 'CRM record not found']); } else { header('Content-Type: application/json'); echo $response; }