Content is not allowed in prolog [closed]

1

I have a problem that is as follows. I have a host that reads a vxml file. However, if I ask him to read a vxml file, it works. But when I generate content via PHP it gives the title error

  

Content is not allowed in prolog

<?php
    header('Content-type: application/xml');
    echo '<?xml version="1.0"?>';
?>

<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <form id="form_Main">
        <var name="callerID" expr="session.callerid" />

        <field name="digit1" type="digits?length=2">
            <prompt bargein="true">Lets add two digit values together</prompt>
            <prompt>Please speak, or key in any two digit value</prompt>

            <filled>
                <log expr="'**** FILLED ******'" />
                <log expr="'**** digit1 =' + digit1 + ' ***'" />
            </filled>
        </field>
        <field name="digit2" type="digits?length=2">
            <prompt bargein="false">Great.</prompt>
            <prompt>Now speak, or key in the second two digit value</prompt>
            <filled>
                <log expr="' *** FILLED *********'" />
                <log expr="' *** digit2 =' + digit2 + ' ***'" />
                <submit next="AddDigits.php" method="get" namelist="digit1 digit2 callerID" />
            </filled>
        </field>
    </form>
</vxml>

The error is in line 3 echo '<?xml version="1.0"?>'; I know it's the apostrophes. However, if I run on my PHP server it works, but when I do the machine read gives the error.

Has anyone ever been through this?

    
asked by anonymous 14.12.2016 / 17:38

1 answer

0

I think the encoding is missing, do this:

<?php
    header('Content-type: application/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">

It is also necessary to check if there is nothing before header . In the example you submitted you do not have any character problems, of course this is the complete example, open the generated XML opens directly in the browser.

    
18.12.2016 / 16:10