PHP code example of xparse / element-finder
1. Go to this page and download the library: Download xparse/element-finder library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xparse / element-finder example snippets
php
$page = new ElementFinder($html);
$title = $page->value('//title')->first();
echo $title;
php
$page = new \Xparse\ElementFinder\ElementFinder('<html>
<div class="tels">
044-12-12,
258-16-16
</div>
<div class="tels">
(148) 04-55-16
</div>
</html>');
$tels = $page->value('//*[@class="tels"]')->split('!,!')->replace("![^0-9]!");
print_r($tels);
/*
[0] => 0441212
[1] => 2581616
[2] => 148045516
*/