PHP code example of gavinggordon / sorcerer
1. Go to this page and download the library: Download gavinggordon/sorcerer 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/ */
gavinggordon / sorcerer example snippets
$data = $scraper->scrape();
print_r( $data );
$scraper->scrape();
php
e GGG\Http\Data\Collection\Sorcerer as Sorcerer;
$scraper = new Sorcerer();
php
$url = 'http://www.testurl.com/index.php';
$regexes = [
'/\<a\s?[^\>]+?\>(.+)\<\/a\>/i',
'/\<img\s?([^\>]+?)[\s\/]*?\>/i'
];
$savefile = __DIR__ . './testurl-scrapedata.txt';
$scraper->configure( $url, $regexes, $savefile );