Hey,
I've got the following HTML that I am trying to pull the state attribute out of.
<div id="content" class="listing mapListing" longitude="123.0000" latitude="-123.0000" listingName="business" business=";12345678;;;;evar01=name" state="NSW" events="1">
I'm trying to match using the following PHP, which doesn't return "NSW".
$xpath = new DomXPath($html);
foreach ($xpath->query("//div[@id='content']") as $item) {
echo $item->getAttribute("state");
}
However, the following; returns "listing" (instead of "listing mapListing") and my suspicion is the space is causing issues
$xpath = new DomXPath($html);
foreach ($xpath->query("//div[@id='content']") as $item) {
echo $item->getAttribute("class");
}
Does anyone have any suggestions on how I can match against "state" attribute?