If you want to just cache the current XML of online models ...
PHP Code:
<?php
//debugging comment out when done
error_reporting(E_ALL);
ini_set('display_errors', '1');
//cache the working XML file locally
$sFileName = './name.xml';
$iCurrentTime = time();
$iFiletime = filemtime($sFileName);
if ($iFiletime < $iCurrentTime - 120) {
$data = file_get_contents('http://URL_here');
$fp = fopen($sFileName, 'w+');
fwrite($fp, $data);
fclose($fp);
}
///load cached xml file
$xml = simplexml_load_file("name.xml");
//You do the rest :OP{...}
?>
Works with PHP 5 untested with PHP 7*