Cannot display XML ,error at the end of document

rodrigoz17

New Member
This is my code \[code\]<?php$allBots = require_once 'botsPath.php';$method = $_SERVER['REQUEST_METHOD'];$request = explode("/", substr(@$_SERVER['PATH_INFO'], 1));//var_dump($allBots);die;$botName = array_shift($request);$res = '';$botJid = '';$returnMessageTo = '';if(isset($allBots[$botName])){ require_once $allBots[$botName]['path']; $botObject = new $allBots[$botName]['class']; $botJid = $allBots[$botName]['jid']; switch (strtolower($method)){ case 'put': $returnMessageTo = $userName = $request[1]; $res = $botObject->subscriptionCreated($userName); break; case 'post': $postType = $request[0]; $postMessage = file_get_contents("php://input"); $postXml = new SimpleXMLElement($postMessage); $returnMessageTo = $from = $postXml['from']; if(strtolower($postType) == 'presence'){ $status = $postXml->status; $text = $postXml->text; $res = $botObject->presenceReceived($from, $status, $text); }else{ $message = $postXml->body; $res = $botObject->messageReceived($from, $message); } break; case 'delete': $returnMessageTo = $userName = $request[1]; $res = $botObject->subscriptionDeleted($userName); break; }}//else, we really do not careheader('Content-type: application/xml');echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><message from='$botJid' to='$returnMessageTo'><body><![CDATA[$res]]></body></message>";\[/code\]It was fine yesterday when i hosted it on my server,but now i am getting the error :\[quote\] This page contains the following errors: error on line 3 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error.\[/quote\]There is nothing written at line 3.Been scratching my head for a while now
 
Back
Top