PHP code example of opportus / web-scraper
1. Go to this page and download the library: Download opportus/web-scraper 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/ */
opportus / web-scraper example snippets
Use Opportus\WebScraper\WebScraper;
$uris = [
'https://en.wikipedia.org/wiki/Web_scraping',
'https://en.wikipedia.org/wiki/XPath',
];
$queries = [
'//p[1][node()]',
'//div[@id="mw-normal-catlinks"]/ul//li[node()]',
];
$scraper = new WebScraper();
$data = $scraper->scrap($uris, $queries); // @see https://github.com/opportus/web-scraper/blob/master/src/DataInterface.php