PHP code example of felix / scraper

1. Go to this page and download the library: Download felix/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/ */

    

felix / scraper example snippets


use Felix\Scraper\Crawler;

$data = Crawler::extracting('https://example.com', '//html/body/div/h1')

return $data->text(); // Example Domain

use Felix\Scraper\Str;

$str = Str::clean("&nbsp; String  Examples \n");

return $str; // -> String Examples

use Felix\Scraper\Url;

$url = Url::normalize('//example.com/post-title');

return $url; // -> http://example.com/post-title