Practice on Parsing with DiDom in PHP
Find the texts of paragraphs with the class elem,
located inside divs with the class block:
<div class="block">
<p class="elem">
+++
</p>
<p class="elem">
+++
</p>
<p class="last">
---
</p>
</div>
<div class="block">
<p class="elem">
+++
</p>
<p class="elem">
+++
</p>
<p class="last">
---
</p>
</div>
<p class="elem">
---
</p>
Find the addresses (href) of all links from the nav:
<a href="page0.html">link0</a>
<nav>
<a href="page1.html">link1</a>
<a href="page2.html">link2</a>
<a href="page3.html">link3</a>
</nav>
Find the paths (src) and alt texts of all
images from the main:
<img src="0.png" alt="text0">
<main>
<img src="1.png" alt="text1">
<img src="2.png" alt="text2">
<img src="3.png" alt="text3">
</main>
Get an array of link addresses (href)
from the main:
<div class="wrapper">
<a href="page0.html">link0</a>
<a href="page0.html">link0</a>
<main>
<a href="page1.html">link1</a>
<a href="page2.html">link2</a>
<a href="page3.html">link3</a>
</main>
Get an array of paths to CSS files:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href='main.css'>
</head>
<body>
<div class="wrapper">
<a href="page1.html">link1</a>
<a href="page2.html">link2</a>
<a href="page3.html">link3</a>
</div>
</body>
</html>