<?php
$rootPath = "";
$cacheTime= 0;
$Diff = (time() - filemtime($rootPath."stuff.dat"))/60;
$cntrp=0;
$cntrb=0;
$cntrt=0;
$cntrd=0;
$cntrc=0;
if ($Diff > $cacheTime) {
$file = fopen ("local file", "r");
if (!$file) {
$dump = "Does not exist";
} else {
while (!feof ($file)) {
$line = fgets ($file);
if (eregi ('<a name="post' . '(.+)' . '"></a>', $line, $pt)) {
$cntrp=$cntrp+1; $post[$cntrp]=$pt[1]; }
if (eregi ('<span class = "gray"><b>' . '(.+)' . '</b>', $line,
$brd)) {$cntrb=$cntrb+1; $board[$cntrb]=$brd[1]; }
if (eregi ('icons/arrow.gif" width=17 height=11 border = 0>' .
'(.+)' . '</a>', $line, $trd)) { $cntrt=$cntrt+1;
$thread[$cntrt]=$trd[1]; }
if (eregi ('<small class = "white">' . '(.+)' . '</small>',
$line, $dtme)) {
$cntrd=$cntrd+1; $datetime[$cntrd] = $dtme[1]; }
if (eregi ('<tr><td valign = "top"><span class = "gray">' . '[.+]'
'</span></td></tr></table>', $line, $cont))
{ $cntrc=$cntrc+1; $content[$cntrc] = $cont[1]; }
}
...
?>
Alright, within the above code my final if (eregi) line is giving me
problems. All 3 of the lines before work, and work great, but the problem
I run into on the final one is newlines. For example, here's a snippet of
the directed file that I'm trying to obtain from:
<tr><td valign = "top"><span class = "gray">
Hello World.
<BR>
<BR>~Me :)
</span></td></tr></table></td>
As you can see, there are multiple newlines in there, and I need to place
the entire snippet between <span class = "gray"> and </span> into a
variable array. My largest problem is that not every instance of said code
has the same number of endlines, but they do ALL have endlines in there.
Any help here?
- Jeremy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php