Good point - I am using 5.3.5 locally for testing - and that matches my web host, so it is what I should code for. Having dome what is recommended elsewhere in the forum, and not started a new thread, I can't mark it as resolved - but it certainly has been for me, thank you very much indeed. This achieves what I was trying to do:
$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTMLFile("$url");
libxml_use_internal_errors(false);
$node = $dom->getElementById('intwrap');
$content = $dom->saveXML($node);
$content = str_replace("
", "", $content);
$file = 'test.txt';
file_put_contents ($file, $content);
header('Location: test.txt');
Our company site, which I coded, is being massively re-skinned, and being given a CMS. I'm happy with the work being outsourced, since I am now semi-retired and working just a couple of days a week. The new contractor (whom I helped choose and get along well with) was asking for content.
As a first step, a lot of content needs to come across from the old site. For the most part, on each page the content lives inside a div with the id 'intwrap'. So I am now able to offer them the guts of each page's content coding, including paths to images and so forth.