test to see if stripped out loadHTMLFile($url); if(!$doc) { throw new Exception("Failed to load $url"); } // Obtain the element $element = $doc->getElementById($id); if(!$element) { throw new Exception("An element with id $id was not found"); } if($pretty) { $doc->formatOutput = true; } // Return the string representation of the element return $doc->saveXML($element); } // call it: (change curl to dedicated serarch page) echo getElementByIdAsString('https://uniroles.co.nz/search-results-jobs/?searchId=1465445889.34&action=search&page=1&listings_per_page=300&view=list', 'listingsResults'); ?>