<?php
require_once("./phpQuery-onefile.php");
$html = file_get_contents("https://ja.wikipedia.org/wiki/%E3%82%A6%E3%82%A7%E3%83%96%E3%82%B9%E3%82%AF%E3%83%AC%E3%82%A4%E3%83%94%E3%83%B3%E3%82%B0");
#ここでhtml全文を取得している
$phpobj = phpQuery::newDocument($html);
#子要素の取得
#欲しい子要素の情報が深くにあっても
#順番に指定すれば取得可能
$children = $phpobj[".asbox, .plainlinks, .noprint > .mbox-image > .mbox-text"];
echo "children";
foreach ($children as $child) {
echo pq($child)->text()."<br>";
echo "----------------<br>";
}
?>
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme