4

I'm using Symfony2 DOMCrawler. I have a link on page. I want to go thru the link and crawl some content there. How can I do it? LEt the code be like this

<a href="www.example.com">Go there</a>

I know about $crawler->selectLink('Go there')->link();

2 Answers2

11

Maybe you are looking for something like :

$link = $crawler->filter('a[id="fabulous_id"]')->attr('href');
$crawler = $client->request('GET',$link);

look DomCrawler Doc for informations

Babou34090
  • 381
  • 3
  • 8
6

You are looking for click() method.

$link = $crawler->selectLink('Go there')->link();
$crawler = $client->click($link);

You should read this documentation chapter more careful

Vitalii Zurian
  • 17,858
  • 4
  • 64
  • 81