PHP Classes

File: server.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Bas van Gaalen  >  dom xml class  >  server.php  >  Download  
File: server.php
Role: Auxiliary script
Content type: text/plain
Description: Server simulation - used in functest.php
Class: dom xml class
An implementation of the DOM XML standard
Author: By
Last change:
Date: 12 years ago
Size: 859 bytes


Class file image Download

// Include the xml library

// Get input data, quit on empty input
    if (empty(
$input)) exit;

// Create XML from input
$qXML = new XML();

// Get name from input
$name = $qXML->firstChild->firstChild->firstChild->nodeValue;
$msg = 'Hello there '.$name;

// Echo back an XML message
$rXML = new XML();
$rXML->xmlDecl = '<?xml version="1.0" encoding="ISO-8859-1" ?>';

// Create query element
$response = $rXML->createElement('response');

// Create message element
$message = $rXML->createElement('message');
$text = $rXML->createTextNode($msg);

// Append response to object

header("Content-Type: text/xml");