I can't give you any code since what I've made is a big mess and you'd spend more time trying to understand it then writing it from scratch.
You should look at the following:cURLSimpleXML
My code usually does the following:
1. Check if you have the XML
1a. If you have the XML, check if it's expired
1aa. If it's expired get the XML off the server
1ab. If it's still valid stop the update since it's not needed
1b. If you don't have the XML, get it off the server
Note: cURL is used to get the XML, SimpleXML/DOM is used to read it.
2. Read the XML and get the data you want
2a. Save the data in a database or create/update a text file
2aa. Create the array you need from the database/text file, or just include the php file (see the note) and use it.
Note: What I did for the map script
I made was to write a PHP file that contained a multi-level array with all the data, built in such a way that it would be easy to use it later.