2

I am crawling an HTML using symfony DomCrawler. I am providing the snippet of HTML that I need to fetch:

<p class="accounts">
  <b>Account:</b>
  <span class="no-wrap">1234567</span>
  <br>
  <b>Type</b>
  987654
</p>

Now I need 987654 text, but I am unsuccessful in doing that. Here is what I have tried:

$dom->filterXPath('//p[@class="accounts"]')->children()->eq(4)->text();
$dom->filterXPath('//p[@class="accounts"]')->children()->eq(4)->html();
$dom->filterXPath('//p[@class="accounts"]')->children()->text();

I am able to get 1234567 as it is under a tag, here it is what I did:

$dom->filterXPath('//p[@class="accounts"]')->children()->eq(1);
Sharad Soni
  • 378
  • 1
  • 5
  • 18

0 Answers0