PHP Classes

File: commandExample.php

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

Contents

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

echo
"<pre>";
echo
"The server runs the command";

echo
"\n-------------------------------";


/**
 * Request 1
 *
 * Gets the day of the server time
 */
echo "\n-------GET SERVER TIME---------";

// Setup test array
$requestArray = array( "command" => "getServerTime" );

// Dump Request Array to Screen
echo "\n\nRequest Array\n\n";
var_dump( $requestArray );

// Setup & Send Request
$Request = new ArrayToXMLClient( "./commandServer.php", $requestArray );

echo
"\n-------------------------------";

// Dump Response Array to Screen
echo "\n\nResponse Array\n\n";
var_dump( $Request->getResponseArray( ) );

echo
"\n-------------------------------";




/**
 * Request 2
 *
 * Gets the day of the day of the week
 */
echo "\n------GET DAY OF THE WEEK------";

// Setup test array
$requestArray = array( "command" => "getDayOfTheWeek" );

// Dump Request Array to Screen
echo "\n\nRequest Array\n\n";
var_dump( $requestArray );

// Setup & Send Request
$Request = new ArrayToXMLClient( "./commandServer.php", $requestArray );

echo
"\n-------------------------------";

// Dump Response Array to Screen
echo "\n\nResponse Array\n\n";
var_dump( $Request->getResponseArray( ) );

echo
"\n-------------------------------";