タスク - ID を使用して DIV タグ内のコンテンツをスクレイピングし、XHTML を返します。「PHP Simple HTML DOM Parser」を使用しています
単純化されたコードの例:
<html><head></head>
<body>
<h1>Head</h1>
<div class="page">
<div id="content">
<h2>Section head</h2>
<p>Text</p>
</div>
<div id="footer">Footer text</div>
</div>
</body>
</html>
私はコンテンツをOKにすることができます:
$content = $html->find('#content');
$content は、配列の simpleDOM オブジェクトになりました (修正されました)。
それをXHTMLに戻すにはどうすればよいので、次のようにします。
<div id="content">
<h2>Section head</h2>
<p>Text</p>
</div>
ありがとう