View Single Post
Old 05-08-2016, 06:06 AM  
Barry-xlovecam
It's 42
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
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*
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote