Content is not allowed in Prolog

Asked

Viewed 205 times

1

I have a problem which 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 submit the 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 on 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 read the machine it gives the error.

Someone’s been through it?

1 answer

0

I believe the encoding, 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 that there is nothing before the header. In the example you sent has no character problem, of course if it is the complete example, open the generated XML opens directly in the browser.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.