Re: get modification date of remote page

From: Date: Sat, 31 May 2003 20:35:04 +0000
Subject: Re: get modification date of remote page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149678@lists.php.net to get a copy of this message
/* UNTESTED. */ function get_http_lm_date($url) { $d = parse_url($url); if ( !$fp = fsockopen ($d['host'], (isset($d['port'])) ? $d['port'] : '80') ) return FALSE; fputs($fp, "HEAD ".$d['path']." HTTP/1.0\r\n\r\n"); while ( !feof($fp) ) { if ( ereg ("^Last-Modified: ", $buf = fgets($fp, 256)) ) { $retval = substr($buf, 15); fclose($fp); } } if ( !isset($retval) ) return FALSE; else return $retval } On Saturday 31 May 2003 12:09 pm, chris wrote: > I have a database full of links. I need to write a script to go to each one > and check the modification date of the file. My plan is, once that is > logged, to do this every week and indicate which pages have "changed." > > What is the simplest approach to this? Do I need to use CURL functions or > remotely open the page with fopen? A pointer to the right place in the > manual would be great... -- The world holds two classes of men -- intelligent men without religion, and religious men without intelligence. -Abu'l-Ala-Al-Ma'arri

« previous php.general (#149678) next »