开发者

XML Making PHP Unexpected String Error [closed]

开发者 https://www.devze.com 2023-04-04 19:30 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I am getting this error

Parse error: syntax error, unexpected T_STRING in /ho.../ssd/recording-goodbye.php on line 1

I have found that this line is causing this:

<?xml version="1.0" encoding="UTF-8"?> 

I think this is because short tags are enabled on this server, it's a shared hosting account and I don't have access to the php.ini file. Is there a way I can perhaps set the headers or escape this line?

This is the full content of recording-goodbye.php

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<Response>
    <Say>Thanks for your recording.  Here is what I heard</Say>
    <Play><?php echo $_REQUEST['Reco开发者_开发百科rdingUrl']; ?></Play>
    <Say>Goodbye</Say>
</Response>


This fixed it

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>


Try the technique described here: http://www.bin-co.com/php/articles/using_php_short_tags.php

It involves treating your xml file so that when it's interpreted by a php configuration using short tags, it will still come through as XML.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号