Goutte icon indicating copy to clipboard operation
Goutte copied to clipboard

Not pulling all html from page?

Open JPeterson2015 opened this issue 5 years ago • 1 comments

Having an issue. I have the following code, im trying to get the pagination which there are 5 links however when I filter through it turns up empty. Very strange because in chrome dev tools I can see the links but when i dd($crawler) the markup for the page is incomplete.

Whats the deal here?

`$url = 'https://www.indeed.com/cmp/Lockheed-Martin/jobs';

    $crawler = Goutte::request('GET', $url);
    $data = $crawler->filter('.cmp-JobDisplay-pagination > .cmp-Pagination > a')->each(function ($node) {
    	return $node->attr('href');
    });
    
    dd($data);`

JPeterson2015 avatar May 16 '20 14:05 JPeterson2015

This is working for me.

$url = 'https://www.indeed.com/cmp/Lockheed-Martin/jobs';

$client = new Client();
$crawler = $client->request('GET', $url);

$data = $crawler->filter('.cmp-JobDisplay-pagination > .cmp-Pagination > a')
    ->each(function ($node) {
        return $node->attr('href');
    });

print_r($data);

Output: Array ( [0] => /cmp/Lockheed-Martin/jobs?start=150 [1] => /cmp/Lockheed-Martin/jobs?start=300 [2] => /cmp/Lockheed-Martin/jobs?start=450 [3] => /cmp/Lockheed-Martin/jobs?start=600 [4] => /cmp/Lockheed-Martin/jobs?start=150 )

sharmadhiraj avatar Jun 26 '20 02:06 sharmadhiraj