T
T
Test2014-09-23 12:16:47
PHP
Test, 2014-09-23 12:16:47

How to parse meta tag?

in general, there is this:
<meta name="description" content="Описание сайта">
you need to get this using php: Description of the site

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Grechushnikov, 2014-09-23
@mes01

google
file_get_contents
preg_match
#<meta.*name="description".*content="(.*?)".*>#siU

H
Heafy, 2014-09-23
@Heafy

@mes01 that's exactly what I'm doing right now :)

$metaTags = get_meta_tags("http://google.com");
isset($metaTags['description']) ? $description = $metaTags['description'] : $description = 'Не обнаружен';
echo $description;

php.net/manual/en/function.get-meta-tags.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question