Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

How to pick href link and text or complete element #341

Open
danillo10 opened this issue Mar 2, 2018 · 1 comment
Open

How to pick href link and text or complete element #341

danillo10 opened this issue Mar 2, 2018 · 1 comment

Comments

@danillo10
Copy link

$noticia = $noticias->filter('article > div > h4 > a')->each(function ($response) {
return $response->text();
});

@dpde
Copy link

dpde commented Apr 6, 2018

Didn't test the code but try something like this.

$crawler->filter($this->productLinkSelector)->each(function($node) {
    $url = $node->attr('href');
    $text = $node->text();
});

For more information feel free to have a look here:
https://github.com/FriendsOfPHP/Goutte#more-information

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants