<?php function getOgUrl($url) {
    // Inicializa cURL
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Seguir redirecionamentos
    curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Timeout de 10 segundos

    // Executa a requisição
    $html = curl_exec($ch);

    // Verifica se houve erro na requisição
    if (curl_errno($ch)) {
        echo 'Erro: ' . curl_error($ch);
        return null;
    }

    // Fecha a conexão cURL
    curl_close($ch);

    // Carrega o HTML no DOMDocument
    $dom = new DOMDocument();
    libxml_use_internal_errors(true); // Ignorar erros de parsing
    $dom->loadHTML($html);
    libxml_clear_errors();

    // Procura pela tag meta com property="og:url"
    $metaTags = $dom->getElementsByTagName('meta');

    foreach ($metaTags as $meta) {
        if ($meta->getAttribute('property') === 'og:url') {
            return $meta->getAttribute('content'); // Retorna o conteúdo da tag
        }
    }

    return null; // Retorna null se não encontrar a tag
}

// Exemplo de uso
$url = "http://w...content-available-to-author-only...o.br/scielo.php?script=sci_arttext&pid=S1519-60892024000100403&lang=pt"; // Substitua pelo link desejado
$ogUrl = getOgUrl($url);

if ($ogUrl) {
    echo "A URL OG é: " . $ogUrl;
} else {
    echo "Tag OG URL não encontrada.";
}?>