Closed sergeynilov closed 1 year ago
In laravel 9.4 app using sabre/xml 4.0 I managed to show custom xml content on the page if I put next code in controller method(GET request) :
header('Content-Type: text/xml'); $writer = new \Sabre\Xml\Writer(); $writer->openMemory(); $writer->namespaceMap = [ 'http://example.org/' => 'e', ]; $writer->startElement('{http://example.org/}root'); $writer->write([ '{http://example.org/ns}title' => 'Item 1', '{http://example.org/ns}author' => 'Item 1',]); $writer->endElement(); echo $writer->outputMemory();
How can I save xml content in file with specified name ?
Has sabre/xml some methods for this or some other tools ?
Thanks!
file_put_contents , or https://www.php.net/manual/en/xmlwriter.openuri.php should do it.
file_put_contents
In laravel 9.4 app using sabre/xml 4.0 I managed to show custom xml content on the page if I put next code in controller method(GET request) :
How can I save xml content in file with specified name ?
Has sabre/xml some methods for this or some other tools ?
Thanks!