Let’s say I’m using simpleXML to parse weather data from a remote server, and then the remote server crashes so I can no longer recover its live feeds but I don’t want my users to get an error message either, how would I go about caching and continuing to display the last piece of data I got from the server before it crashed?
Let’s say my xml looks like this:
<weather>
<temperature c="25" f="77">
</weather>
How would I go about displaying the values “25” and “77” until I’m able to reestablish a connection with the remote server?
Apologies if my question isn’t entirely clear… my knowledge of server-side technologies is very limited.
This isn’t the best way, but here is one way you could do it:
To save the information
To load it
By including the file, your $c and $f variables will be set unless you overwrite them.