M
M
Mopaa2018-06-10 14:27:04
PHP
Mopaa, 2018-06-10 14:27:04

How to parse meta tags?

I use the simple_html_dom.php library. Title was parsed the first time:

include_once ('simple_html_dom.php');
    $ht = curl_get('http://site.ru');
    $html = str_get_html($ht);
    $pageTitle = $html->find('title',0);

And description does not work, how to do it? Tried the following methods:
$pageTitle = $html->find('description',0);
$pageTitle = $html->find('description');
$pageTitle = $html->find(meta[description]);

and so on, but when I try to display I get emptiness ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lander, 2018-06-10
@usdglander

$html->find('meta[name="description"]');
upd: Would you read about selectors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question