I am trying to create an XML file output in PHP for a remote phone book on an IP Phone, here is the code i have:
<?php
$conn=mysql_connect("localhost","user","********");
mysql_select_db("db_name",$conn);
header("Content-Type: text/xml");
header("Connection: close");
header("Expires: -1");
?>
<YealinkIPPhoneDirectory>
<?php
$output='<YealinkIPPhoneDirectory>
';
$sql="SELECT * from contacts ";
$rs=mysql_query($sql,$conn);
while($result=mysql_fetch_array($rs)) {
$output .= "<DirectoryEntry>
";
$output .= "<Name>Mobile:</Name>
";
$output .= "<Telephone>" . $result["mobile"] . "</Telephone>
";
$output .= "</DirectoryEntry>
";
}
$output='</YealinkIPPhoneDirectory>
';
echo '$output';
?>
but i get this error message:
This page contains the following errors:
error on line 3 at column 8: Extra content at the end of the document
Below is a rendering of the page up to the first error.
$output