Prior to 4.3, you can use [man]readfile[/man] to fetch the header and footer, and echo them directly to the page.
Note that whichever of these methods is being used, because the header and footer are on another server, if they're PHP scripts they'll be run on that other server, and what you'll receive is the resulting output.