PHP code example of collab / module-scraper
1. Go to this page and download the library: Download collab/module-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/ */
collab / module-scraper example snippets
use Collab\Scraper\Service\ScraperService;
...
public function __construct(
ScraperService $scraperService
) {
$this->scraperService = $scraperService;
}
...
public function getScrapedData(): ?string
{
$url = 'https://www.example.com';
$data = $this->scraperService->go($url);
echo $data->title; // Title of the page
return $data;
}