I have two servers
Server A reads http://www.some-url.com/xmlwriter_src.php using
$reader = new XMLReader();
$reader->open('http://www.some-url.com/xmlwriter_src.php');
while ($reader->read())
{
/* -- do something -- */
}
Server B creates an xml stream
$writer = new XMLWriter();
$writer->openURI('php://output');
$writer->startDocument("1.0");
$writer->startElement("records");
while(!$recordset->EOF)
{
$writer->startElement($fieldname)
$writer->text($recordset->fields[$fieldname]);
$writer->endElement();
$recordset->movenext();
}
the xmlreader on server A keeps complaining that server B doesnt respond, even though I can see the xml result in the browser.
It takes less than a second to generate
If i copy the xml to a static file, the xmlreader outputs the file.
By default the writter will buffer your output. Once you are done you MUST call flush().
$writer = new XMLWriter();
$writer->openURI('php://output');
$writer->startDocument("1.0");
$writer->startElement("records");
while(!$recordset->EOF)
{
$writer->startElement($fieldname)
$writer->text($recordset->fields[$fieldname]);
$writer->endElement();
$recordset->movenext();
}
$writer->flush();
By the way: where do you close the records element?