Richard Winnick
asked on
use php variables in simple xml
We are just learning vxml and are trying to use $_REQUEST to get a variable from the url and place it in a dom doc to create a simple xml/vxml output -
We have tried the following code but get a parse error -
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in xxxxxxxxxxxxxx.php on line 10 -
What are we missing -
Thanks in advance for the help
<?php
$doc = new DomDocument('1.0');
$doc ="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$doc .="<vxml version = \"2.1\" >\n";
$doc .="<form id=\"mainDialog\">\n";
$doc .="<prompt> your caller id is <?php $_REQUEST['callerid'];?></ prompt>\n" ;
$doc .="</form>\n";
$doc .="</vxml>\n";
$sxe = new SimpleXMLElement($doc);
echo $sxe->asXML();
?>
We have tried the following code but get a parse error -
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
What are we missing -
Thanks in advance for the help
<?php
$doc = new DomDocument('1.0');
$doc ="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$doc .="<vxml version = \"2.1\" >\n";
$doc .="<form id=\"mainDialog\">\n";
$doc .="<prompt> your caller id is <?php $_REQUEST['callerid'];?></
$doc .="</form>\n";
$doc .="</vxml>\n";
$sxe = new SimpleXMLElement($doc);
echo $sxe->asXML();
?>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Chris provided initial insight and Ray elaborated in depth so owe both you guys our thanks and feel it's fair to split the points evenly -
Hope this is OK with all -
As always EE is the greatest -
Thanks
Richard
Hope this is OK with all -
As always EE is the greatest -
Thanks
Richard
Open in new window