Marc Roberts wrote: > > Thanks for the response, > > I think I have solved the problem using the code in the attached text > document. > > Thanks for the help, > Marc > > Roman Neuhauser wrote: >> # marc.roberts@xxxxxxxxxxxxxxxx / 2006-10-18 17:23:53 +0200: >>> Is it possible to receive information on a html site, such as the >>> language, date modified? >>> >>> If so how would I go about doing this? >> >> Your question is very vague, so I'm taking the liberty of >> interpretation. >> >> - ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt >> - http://www.php.net/http >> (haven't used pecl_http myself, you might have to resort to >> http://www.php.net/sockets) >> > > > function get_raw_header($host,$doc) > { > $httpheader = ''; > $fp = fsockopen ($host, 80, $errno, $errstr, 30); > if (!$fp) > { > echo $errstr.' ('.$errno.')'; > }else{ > fputs($fp, 'GET '.$doc.' HTTP/1.0'."\r\n".'Host: '.$host."\r\n\r\n"); > while(!feof($fp)) > { > $httpresult = fgets ($fp,1024); > $httpheader = $httpheader.$httpresult; > if (ereg("^\r\n",$httpresult)) > break; > } > fclose ($fp); > } > return $httpheader; > } > > function get_header_array($Url) > { > $Url = ereg_replace('http://','',$Url); > $endHostPos = strpos($Url,'/'); > if(!$endHostPos) $endHostPos = strlen($Url); > $host = substr($Url,0,$endHostPos); > $doc = substr($Url,$endHostPos,strlen($Url)-$endHostPos); > if($doc == '') $doc = '/'; > $raw = get_raw_header($host,$doc); > $tmpArray = explode("\n",$raw); > for ($i=0;$i<sizeof($tmpArray); $i++) > { > @list($Name, $value) = explode(':', $tmpArray[$i], 2); > $array[trim($Name)]=trim($value); > } > return $array; > } > > $remote_file = 'http://www.whatever.com/';//states which url to read the > modified date from > $array = get_header_array($remote_file);//gets the data on the page > $remote_file > $deUpdate = date('Ymj',strtotime($array['Last-modified'])); > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > not every site sends 'Last-modified' , f.e. www.heise.de: --- HTTP/1.1 200 OK Date: Fri, 20 Oct 2006 18:27:03 GMT Server: Apache/1.3.34 Expires: Fri, 20 Oct 2006 18:42:03 GMT Vary: Accept-Encoding Connection: close Content-Type: text/html; charset=iso-8859-1 --- -- View this message in context: http://www.nabble.com/Recieve-information-on-a-html-site-using-php--tf2478503.html#a6922634 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php