I have this code:
<li datetime="2019-06-03T14:45" offset="-135" type="standard"></li>
... etc.
How I can get datetime attribute value if all elements contain attribute type with value standard? So how I can get datetime value (2019-06-03T14:45) from each li element
I tried:
$timeslots = [];
$dom = new \DOMDocument();
@$dom->loadHTML($html);
$xpath = new \DOMXPath($dom);
$entries = $xpath->query('//li[@type="standard"])/@datetime');
foreach($entries as $e) {
$timeslots[] = $e->textContent;
}
$ts = $timeslots;
return $ts;
but I got an error:
DOMXPath::query(): Invalid expression

)inli[@type="standard"])/