Need help with PHPScraper?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

spekulatius
144 Stars 10 Forks GNU General Public License v3.0 60 Commits 9 Opened issues

Description

PHP Scraper - an highly opinionated web-interface for PHP

Services available

!
?

Need anything else?

Contributors list

# 1,924
coreml-...
ios11
mac
php7
54 commits
# 2,836
Flutter
assembl...
spotify
gc
1 commit
# 259,385
Lua
Telegra...
mtproto
amphp
1 commit

PHP Scraper

PHP Scraper

An opinionated & limited way to scrape the web using PHP. The main goal is to get stuff done instead of getting distracted with xPath selectors, preparing data structures, etc. Instead, you can just "go to a website" and get an array with all details relevant to your scraping project.

Under the hood, it uses Goutte and a few other packages. See composer.json.

Sponsors

This project is sponsored by:

Want to sponsor this project? Contact me.

Examples

Here are a few impressions on the way the library works. More examples are on the project website.

Get the Title of a Website

All scraping functionality can be accessed either as a function call or a property call. On the example of title scraping this would like like this:

$web = new \spekulatius\phpscraper();

$web->go('https://google.com');

// Returns "Google" echo $web->title;

// Also returns "Google" echo $web->title();

Scrape the Images from a Website

Scraping the images including the attributes of the

img
-tags:
$web = new \spekulatius\phpscraper();

/**

var_dump($web->imagesWithDetails); /**

  • Contains:
  • [
  • 'url' => 'https://test-pages.phpscraper.de/assets/cat.jpg',
  • 'alt' => 'absolute path',
  • 'width' => null,
  • 'height' => null,
  • ],
  • [
  • 'url' => 'https://test-pages.phpscraper.de/assets/cat.jpg',
  • 'alt' => 'relative path',
  • 'width' => null,
  • 'height' => null,
  • ]
  • /

See the full documentation for more information and examples.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.