<?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);
#hタグを取得
$headers = $phpobj[":header"];
#foreachで回して、pqで囲ってtext()するとhタグで囲まれた文字列を取得できる
foreach ($headers as $header) {
echo pq($header)->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
List of users who liked
00