getElementByTagName を使用して、html ファイルからタグを解析できます。しかし、そのhtmlファイルに存在するIDとクラス名も解析したい...
これは私が試したものです:-
$html = new DOMDocument();
$html->loadHTMLFile($url); //url is the url of the site
$data = $html->getElementById($identifier); //identifier is the id
$value = array();
foreach($data as $element)
{
$value[] = $element->nodeValue."<br />";
}
print_r($value);
しかし、getElementById を使用すると、array() として出力を取得するだけです。データを解析できません。また、IDとクラス名の値を取得する方法を教えてください??