Files
php-func-lib/og.php
2026-02-15 14:45:02 +01:00

18 lines
358 B
PHP

<?php
declare(strict_types=1);
function scanOG(string $url): array {
$og = array();
$html = file_get_contents($url);
$re = '/<meta (name|property)=("|\')(.*?)("|\').*?content=("|\')(.*?)("|\')/m';
preg_match_all($re, $html, $matches, PREG_SET_ORDER, 0);
foreach($matches as $m) {
$og[$m[3]] = $m[6];
}
//print_r($og);
return $og;
}
?>