where I can find simple html dom parser for laravel 5? I'm looking for somethink like this: http://simplehtmldom.sourceforge.net/manual.htm
A Simple HTML DOM parser written in PHP let you manipulate HTML in a easy way with selectors just like CSS or jQuery. This is modern version of Simple HTML DOM. You can install by using Composer and import to your project as a package.
PHP Simple HTML DOM ParserA fast, simple and reliable HTML document parser for PHP. Created by S.C. Chen, based on HTML Parser for PHP 4 by Jose Solorzano.
The web scraping can be done by targeting the selected DOM components and then processing or storing the text between that DOM element of a web page. To do the same in PHP, there is an API which parses the whole page and looks for the required elements within the DOM. It is the Simple HTML DOM Parser.
I recommend FriendsOfPHP/Goutte, it's deservedly one of the most popular PHP crawlers on GitHub.
Controller
$crawler->filter('a[class="o_title"][href]')->each(function ($node) {
$hrefs[] = $node->attr('href');
});
return view('some-template', ['hrefs' => $hrefs]);
View
@foreach ($hrefs as $href)
{{ $href }}
@endforeach
In your case it will be:
$crawler = $client->request(
'GET',
'http://www.oglaszamy24.pl/ogloszenia/nieruchomosci/domy/?std=1&results=100000'
);
$text = $crawler->filter('.resultpages_current')->text();
$numPages = intval(preg_replace('/[^0-9]/', '', $text));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With