An oppinated & limited way to access the web using PHP. This is an extension to provide an alternative interface to Goutte. The examples tell the story much better. Have a look!
PHP Scraper alternatives and similar libraries
Based on the "Scraping" category.
Alternatively, view PHP Scraper alternatives based on common mentions on social networks and blogs.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of PHP Scraper or a related project?
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.
This project is sponsored by:
Want to sponsor this project? Contact me.
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
$web = new \spekulatius\phpscraper(); /** * Navigate to the test page. * * This page contains twice the image "cat.jpg". * Once with a relative path and once with an absolute path. */ $web->go('https://test-pages.phpscraper.de/meta/lorem-ipsum.html'); 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.