I am in a very tight time crunch to get this working, please if there is anyone who could help me with this I would GREATLY appreciate it. I have searched all over before I have posted to see if I could find a similar example but can't find any.. What I need to do is to have a php script scan a folder of about 12 files, detect by date/time modified which one is the newest and echo that files contents back. I already have most of that done, just need to figure out how to detect the newest filename. What I need to incorporate this into is the code below which currently only reads from one set file. All that needs to be done is the filename variable needs to be determined based on newest xml file in the folder, which could have a variety of names, in the same folder this php script is located. Thank you so much to anyone who can help me out with this, this has to go live very early in the morning..

Thanks!!
Chris

<?php
$filename = 'file.xml';
$blank_file = 'blank.xml';

if (file_exists($filename)) {
		$xml = file_get_contents ($filename);
		if (preg_match("#</(text1|text2)>#", $xml)) {
		echo $xml;
		} else {
		$blank = file_get_contents ($blank_file);
		echo $blank;
		}
} else {
	$blank = file_get_contents ($blank_file);
	echo "$blank";
}
?> 
    5 days later
    Write a Reply...