PHP code example of martinille / meta-tag-extraction

1. Go to this page and download the library: Download martinille/meta-tag-extraction library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

martinille / meta-tag-extraction example snippets


use MartinIlle\MetaTagExtraction\MetaTagExtraction;

$url = 'https://example.com';
$metaTagExtraction = new MetaTagExtraction();

$metaTags = $metaTagExtraction->extractFromUrl($url);

foreach ($metaTags as $tag) {
	echo $tag->getName() . ': ' . $tag->getValue() . PHP_EOL;
}
/* output:
charset: utf-8
content-type: text/html; charset=utf-8
viewport: width=device-width, initial-scale=1
title: Example Domain
*/