p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Problem getting file date


Message #1 by "Dave Brown" <dave@m...> on Sun, 15 Sep 2002 22:00:56
I'm trying to read a file date at $URL_sp:

//URL of MISys Service Pack

$URL_sp = "http://www.misysinc.com/downloads/2021.wmv";

// Date of currently installed Service Pack

$F3=18991230

$sp_sys_year = substr($F3, 0, 4);
$sp_sys_month = substr($F3, 4, 2);
$sp_sys_day = substr($F3, 6, 2);

// Date of currently available Service Pack

$sp_filedate = getdate(filemtime($URL_sp));
$sp_year = $sp_filedate["year"];
$sp_month = $sp_filedate["mon"];
$sp_day = $sp_filedate["mday"];

// Calculate the offset ($sp_offset is zero if current, positive if behind)

$sp_year_offset = $sp_year - $sp_sys_year;
$sp_month_offset = $sp_month - $sp_sys_month;
$sp_day_offset = $sp_day - $sp_sys_day;
$sp_offset = $sp_year_offset + $sp_month_offset + $sp_day_offset;

//

if ($sp_offset == 0)
	{
	 $msg3 = "Your software is up to date.";
	}
else 
	{
     $sp_status = "<font face='Verdana' size='2' color='red'><b> WARNING! 
This software is out of date.</b>";
     	}

I believe something is wrong with: $URL_sp 
= "http://www.misysinc.com/downloads/2021.wmv" The file is there, 
correctly capitalized, and I can see the file date in WS_FTP.

Any ideas?

Thanks!
Message #2 by "Nikolai Devereaux" <yomama@u...> on Mon, 16 Sep 2002 11:35:18 -0700
Okay, one major caveat here --

from http://www.php.net/filemtime

"This function will not work on remote files; the file to be examined must
be accessible via the server's filesystem."


hth,

nik


  Return to Index