cristopherm/simple-scraper

A simple scraper for HTML pages in PHP

dev-main 2021-02-21 11:32 UTC

This package is not auto-updated.

Last update: 2024-09-30 11:35:56 UTC


README

A simple HTML scraper in PHP.

Install

Via Composer

$ composer require cristopherm/simple-scraper

Usage

The parse method will return a object with the following properties:

  • title
  • tags
  • description
  • content

You can use a raw HTML string or an URL with the methods loadString() and loadUrl() respectively.

Example:

use Cristopherm\SimpleScraper\HtmlParser;

$file = new HtmlParser();

$result = $file
    ->loadString($rawFile)
    ->idsForCleaning(['some-id', 'another-id'])
    ->parse();

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email cristopher.martins@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.