使用PHP中的file_get_contents和getElementsByClassName来拉取页面元素的表单

I'm attempting to create a page where I input a url and the PHP code uses that to pull page elements from another website to be displayed on my blog post. I haven't even made it as far as the form, right now I just need to understand how to get this code to work so that it displays the page elements within the div with the class "products-grid first odd".

<?php
$homepage = file_get_contents('website');
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$dochtml->getElementsByClassName('products-grid first odd');
echo ????
?>

The PHP DOMDocument object does not appear to have the method getElementsByClassName().

Instead, I think you would have to getElementsByTagName() and then loop through those DOMElements and getAttribute('class') on each and check until you find the right one.