代码如下:
<?php /** * php在指定时间内过期 * edit by www.jb200.com */ while(! ($dataFile = @fopen('http://www.jb200.com/6892.html', "r" )) ){ sleep(2); } //$dataFile = fopen('data.txt', "r" ) ; $buffer = ''; if ( $dataFile ) { $buffer = ""; while (!feof($dataFile)) { $buffer .= fgets($dataFile, 4096); } //$buffer = iconv('gb2312','utf-8',$buffer); fclose($dataFile); $pos1 = strpos($buffer,'最后发表'); $text = substr($buffer,$pos1,1300); $pos1 = strpos($text,'<span class="f9 gray">'); $text = substr($text,$pos1+strlen('<span class="f9 gray">')); $text = substr($text,0,strpos($text,']')); //$text = substr($buffer,$pos1,24*2-3);[2008-05-16 11:07] $date = preg_replace("/^/[(/d+)-(/d+)-(/d+)/s+(/d+):(/d+)$/","/$1-/$2-/$3 /$4:/$5",$text).date(":s"); if(strtotime($date)>mktime(12,12,12,5,15,2008)){ header("HTTP/1.0 501 Server Error"); exit('<title>HTTP 501 - Server Internal Error</title>Server Internal Error.'); }else{ echo '<hr>'; } }else{ exit('server is down!'); } ?>