<?php

$html = '<html>
<head>
<meta name="keywords" content="slovo, slovo2, slovo3">
<meta name="description" content="Tento text potřebuji vyextrahovat"> 
</head>';

$doc = new DOMDocument();
@$doc->loadHTML($html);
$tags = $doc->getElementsByTagName('meta');


 
foreach ($tags as $tag) {
       echo $tag->getAttribute('content');
 
        }