PHP code example of simplon / spider
1. Go to this page and download the library: Download simplon/spider 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/ */
simplon / spider example snippets
use Simplon\Spider\Spider;
// fetch and parse
$data = Spider::fetchParse('http://cnn.com');
echo json_encode($data); // json encode result
use Simplon\Spider\Spider;
// page html
$html = '...';
// fetch and parse
$data = Spider::parse($html, 'http://cnn.com'); // URL is needed to rebuild absolute image paths
echo json_encode($data); // json encode result