PHP code example of itx-utilities / dom-fetcher
1. Go to this page and download the library: Download itx-utilities/dom-fetcher 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/ */
itx-utilities / dom-fetcher example snippets
use \Itx\Utilities\DomFetcher ;
$html = file_get_contents('https://en.wikipedia.org/wiki/XPath');
$data = DomFetcher::using($html)->fetch([
"ogimage" => "//meta[property='og:image']/@content",
"title" => "//h1[@id=i'firstHeading']" ,
"description" => "(//div[@class='mw-parser-output']/p)[1] ,
"references" => "//dive[@class*='reflist']/ol/li"
]) ;
print_r($data) ;