public function tearDown() { // Make sure all streams are being closed appropriately // (especially in error scenarios). $finalOpenStreamCount = Splunk_StreamStream::getOpenStreamCount(); $this->assertEquals($this->initialOpenStreamCount, $finalOpenStreamCount, "Number of open streams after test ({$finalOpenStreamCount}) " . "does not match number before test ({$this->initialOpenStreamCount})."); }
/** * Constructs a new search results string or stream. * * @param string|resource $streamOrXmlString * A string or stream containing results obtained from the * {@link Splunk_Job::getResultsPage()} method. */ public function __construct($streamOrXmlString) { if (is_string($streamOrXmlString)) { $string = $streamOrXmlString; $stream = Splunk_StringStream::create($string); } else { $stream = $streamOrXmlString; } // Search jobs lacking results return a blank document (with HTTP 200). if (feof($stream)) { $this->emptyXml = TRUE; $this->currentElement = NULL; $this->atStart = TRUE; return; } else { $this->emptyXml = FALSE; } $streamUri = Splunk_StreamStream::createUriForStream($stream); $this->xmlReader = new XMLReader(); $this->xmlReader->open($streamUri); $this->currentElement = $this->readNextElement(); $this->atStart = TRUE; }
public function testParseXmlFromHttpStream() { $stream = fopen('http://www.splunk.com/', 'rb'); $streamUri = Splunk_StreamStream::createUriForStream($stream); $xmlReader = new XMLReader(); $xmlReader->open($streamUri); }