I am writing a proxy service for caching the queries that my mobile app makes to webservice. (like a man in the middle)
The task of proxy site I have built is pass the query it gets from the app onto third party webservice and save the response from the third party webservice as an XML file and for all subsequent calls for the same query read from the XML file and provide the response (basically caching the response -using Php, curl and simplexml_load_file).
Now my question is - What is the recommended way to read an xml file and return the string.
option 1: $contents = file_get_contents($filename); echo $contents;
option 2: $xml=simplexml_load_file($filename) echo $xml->asXML();