Appendix: Obtaining the XML
/**
* Processes the XML stream from STDIN.
*
* <p>Reads STDIN. The data is accumulated in the class' <var>$ContentsRaw</var>
* variable. When the transmission separation character is reached this method
* executes the <code>runParser()</code> method.</p>
*
* <p>If the connection to the WireParserClient is severed, even
* if intentionally by you, an error message will be generated
* that says "SportsTicker connection lost..."</p>
*/
function readStdinStream() {
$In = fopen('php://stdin', 'r');
while ( !feof($In) ) {
$Line = fgets($In, 5000);
$this->ContentsRaw .= $Line;
if ( preg_match('/\x04/', $Line) ) {
// Last line of transmission. Parse it.
$this->runParser();
}
}
$this->killProcess('SportsTicker connection lost: ' . date('Y-m-d H:i:s') );
}