$ageInSeconds = 300; // one hour
$myartid = $_REQUEST['myartid'];
if ($myartid <> ”) {
$cacheName = ‘xmlcache/’.$myartid.’.xml’;
$myarturl = ‘http://xml.corporate-ir.net/irxmlclient.asp?compid=196053&reqtype=releasetxt&reqid=’ . $myartid;
// generate the cache version if it doesn’t exist or it’s too old!
if(!file_exists($cacheName) || filemtime($cacheName) + $ageInSeconds < time()) {
$contents = file_get_contents($myarturl);
file_put_contents($cacheName, $contents);
}
$xml=simplexml_load_file($cacheName);
for ($x = 0; $x <= $countresult; $x++) {
$myarticle = $xml->NewsReleaseText->ReleaseText;
$mystartdate = $xml->NewsReleaseText->Date;
$mytitle = $xml->NewsReleaseText->Title;
$createDate = new DateTime($mystartdate);
$mystartdateclean = $createDate->format(‘Y-m-d’);
echo ‘
‘;
echo ‘
‘. $mytitle . ‘
‘;
echo $myarticle;
}
//print_r($xml);
}
?>