PHP Classes

File: commandServer.php

Recommend this page to a friend!
  Classes of Joe Bloggs   ArrayToXML   commandServer.php   Download  
File: commandServer.php
Role: Example script
Content type: text/plain
Description: Server Side Example - Processing Commands
Class: ArrayToXML
Send and receive arrays as XML via HTTP
Author: By
Last change:
Date: 15 years ago
Size: 564 bytes
 

Contents

Class file image Download
<?php
require_once("./ArrayToXML.class.php");

// Setup Server
$server = new ArrayToXMLServer( $HTTP_RAW_POST_DATA );
$requestArray = $server->getRequestArray();


// Run Commands
switch($requestArray['command'])
{
    case
"getServerTime":
       
$response = date("G:i");
        break;
    case
"getDayOfTheWeek":
       
$response = date("l");
        break;
    default:
       
$response = "Command not found";
        break;
}

$responseArray['response'] = $response;


// Send Response Array
$server->sendResponse($responseArray);