Let's say I'm scraping this code (keep in mind that this article is wrapped in other tags):
<article class="offer-item">
<h3>A Title</h3>
<a href="#">
<span class="offer-item-title">Content that I want</span>
</a>
</article>
I have the following code for scraping the above code:
$dom = new DomDocument;
$dom->loadHTMLFile("URL");
$xpath = new DomXPath($dom);
$listing_url = $xpath->query("//article[@class='offer-item']//span[@class='offer-item-title']");
But it isn't working and I know in fact that it is because of the article tag. Because if I remove it and leave it like this it works:
$listing_url = $xpath->query("//span[@class='offer-item-title']");
Thanks to whoever can help me! Really appreciate it!