0
votes

I have a php file which requests xml data and displays it it the browser. The XML is displayed by:

$xmlString = constructPostCallAndGetResponse($endpoint, $item, $postCode, $dist);

$resp = simplexml_load_string($xmlString);

echo htmlentities($xmlString);

How do I save the returned XML to an XML file on my server? Ive read alot about DOM but keep going in circles. Can anyone suggest a simple way of doing this?

1

1 Answers

3
votes

to save to file, with your sinplexml-object just do...

$resp->asXML('file.xml');