Closed Thread Icon

Topic awaiting preservation: [PHP] timestamp of a remote file (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=13124" title="Pages that link to Topic awaiting preservation: [PHP] timestamp of a remote file (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: [PHP] timestamp of a remote file <span class="small">(Page 1 of 1)</span>\

 
u-neek
Bipolar (III) Inmate

From: Berlin, Germany
Insane since: Jan 2001

posted posted 04-06-2004 12:05

How can i get the time of last modification of a remote file?

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 04-06-2004 13:15

well... depends on what you understand as 'remote file' - with http, probably only if the sites' sending a 'last-modified' header...
with ftp, ftp_mdtm would be the appropriate function.

u-neek
Bipolar (III) Inmate

From: Berlin, Germany
Insane since: Jan 2001

posted posted 04-06-2004 13:50

666!!


With http.
How can i get that header?

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 04-06-2004 14:40

I'd try something like the code below,
or see if pear has a http class that returns the headers to you.


code:
if ($fh = fsockopen($ip_of_host); //could get ip via nslookup)
{
fwrite($fh,"GET /somePath/someFile HTTP/1.0\r\n");
fwrite($fh,"Host: [url=http://www.domain.com\r\n");]www.domain.com\r\n");[/url]
fwrite($fh,"\r\n");
$strRes = fread($fh,2048);
$strHeaders = substr($strRes,0,strpos("\r\n\r\n",$strRes));
$arrHeaders = explode("\r\n,$strHeaders);
$arrAscHeaders = array();
foreach ($arrHeaders as $straHeader)
{
$arrAscHeaders[substr($straHeader,0,strpos(':',$straHeader)] = substr($straHeader,strpos(':',$straHeader) + 2);
}
print $arrAscHeaders['last-modified']; //look up in http rfc
}

« BackwardsOnwards »

Show Forum Drop Down Menu