I want to select just a class on its own called .date For some reason, I cannot get this to work. If anyone knows what is wrong with my code, it would be much appreciated. @$doc = new DOMDocument(); @$doc->loadHTML($html); $xml = simplexml_import_dom($doc); // just to make xpath more simple $images = $xml->xpath('//[@class="date"]'); foreach ($images as $img) { echo $img." "; }