I’m trying to retrieve the game mode of a server.
This is the code:
<p>
<strong>Grand Bazaar</strong>
<span class="bullet">•</span>
Rush •
<img src="src.png">
</p>
I’m trying to find Rush. I tried this script:
foreach($html->find('p .bullet') as $e)
{
$mode = $e->nextSibling ();
}
But the script just skips “Rush” and continues over to the next tag.
I’m sure you guys know what you’re doing better than me.
Could anyone help me out here?
You need to make your questions clearer mate… “I’m trying to retrieve the game mode of a server” <- This is irrelevant in relation with your problem for example.
The problem you’re having is that “Rush” is nothing but text, it’s not a sibling of .bullet as that would imply Rush being the content of a tag that’s a sibling to .bullet, say
If the structure you presented is identical all the time though, and you’re using Simple HTML DOM by the looks of the code (http://simplehtmldom.sourceforge.net/), then you could maybe clear the contents of the tag first:
And then just strip_tags() on the whole paragraph and get the text?