r/PHPhelp • u/Fyreborn • Sep 13 '22
Suggestions for PHP web scraper libraries?
I am looking for suggestions on web scraping libraries, to scrape non-JavaScript pages. So just a standard scraper, not something that has to render with a browser, like Symfony Panther.
I am familiar with Goutte, and when I searched "goutte alternatives" I found links to Embed, PHP Scraper, and PHP Spider. But I haven't tried them, or know if there's any reason to prefer one over the others.
Are there are any other significant PHP scraping libraries? What is currently the most popular or most standard PHP scraper? What should I be looking for in terms of choosing between the options?
5
u/PetahNZ Sep 13 '22
I have always found Simple HTML DOM quite good to work with random HTML that may be invalid: https://simplehtmldom.sourceforge.io/docs/1.9/index.html
1
4
1
u/itemluminouswadison Sep 14 '22
Domxpath is easy. Chrome inspector you can copy out xpath paths easily too
7
u/MateusAzevedo Sep 13 '22
Synfony also has BrowserKit and DomCrawler that may be helpful.