I am trying to extract title and description out of web pages, using DOMdocument(), I am successful in extracting title like this
$d=new DOMDocument();
$d->loadHTML($html);
$title=$d->getElementsByTagName("title")->item(0)->textContent;
I can extract the description by looping through all meta tags
and checking for the name="desctiption"
attribute but looping makes the process slow so wanted to know if there can be a direct method for extracting content using some attribute selector in php DOMdocument??