My server.php file code is as below. I get an error saying "This page contains the following errors:
error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error."
$server->register('restaurant');
// Define the method as a PHP function
function restaurant($id) {
$query = "SELECT * FROM `member_details` where Id=$id";
$result = mysql_query($query);
if(!$result )
{
die('Could not get data: ' . mysql_error());
}
$xml_output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n";
$xml_output .= "<?xml-stylesheet type=\"text/xsl\" href=\"xsltDetails.xsl\"?>";
$xml_output .= "<dataset>\n";
for($x = 0 ; $x < mysql_num_rows($result) ; $x++){
$row = mysql_fetch_assoc($result);
$xml_output .= "<entry>\n";
$xml_output .= "<id>".$row['Id']."</id>\n";
$xml_output .= "<name>".$row['Name']."</name>\n";
$xml_output .= "<address>".$row['Address']."</address>\n";
$xml_output .= "<postcode>".$row['Postcode']."</postcode>\n";
$xml_output .= "<telephone>".$row['Telephone']."</telephone>\n";
$xml_output .= "<opentime>".$row['OpenTime']."</opentime>\n";
$xml_output .= "<restauranttype>".$row['ResType']."</restauranttype>\n";
$xml_output .= "<licence>".$row['Licence']."</licence>\n";
$xml_output .= "<keywords>".$row['Keywords']."</keywords>\n";
$xml_output .= "<cuisine>".$row['Cuisine']."</cuisine>\n";
$xml_output .= "</entry>\n";
}
$xml_output .= "</dataset>\n";
return $xml_output;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>