0

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 Answer 1

3

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

$resp->asXML('file.xml');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.