This might have been answered somewhere else if so sorry. I have an dynamic XML document on a remote server that has the line <?xml version="1.0" encoding="UTF-8"?> on the first line. This causes PHP to throw an exemption I’m guessing because of the ?>
My question is how do I include this document in my page without causing PHP to throw an exception?
Cheers
EDIT: I’m including by using require, probably not the correct way to do it?
This sounds like an issue with the
short_open_tagconfiguration option, which will interpret<?as a PHP opening tag. You may want to try using the ini_set() function to setshort_open_tagtofalseimmediately before including the remote file, and then switch it back afterwards.EDIT: If the file/URL you’re referencing doesn’t contain any PHP code that needs to be run, you can use the readfile() function to read and output its contents in one fell swoop. This will break if the file, as downloaded from the server, contains PHP snippets, but should work if the data is completely ready to go.