<?php
// listar_webhooks.php - Listar webhooks cadastrados

$token = "T6BuPKa33JP2oXtJUsTanOnl5lf3DeFl";
$ambiente = "homologacao";

$baseUrl = $ambiente == 'producao' ? 'https://api.focusnfe.com.br/v2' : 'https://homologacao.focusnfe.com.br/v2';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/hooks');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Basic ' . base64_encode($token . ':')
]);
$resposta = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "HTTP Code: $httpCode\n";
echo "Resposta: $resposta\n";
?>