Hi,
Another question, I am attempting to take an HTML file, and read the unique contents of the page into the variable $realcontent. The real content is separated by HTML comments, should be fairly obvious. I'm replacing these comments with ¬search¬, and this works fine (on the assumption that none of my site users will write ¬search¬). However, $bufexplode[1] returns empty, any ideas?
The problem appears to be in the the $bufexplode line, as the rest is outputting as predicted.
if( !($fd = fopen($url,"r")) )
die( "Could not open URL!" );
while( $buf = fgets($fd,1024) ){
/* Remove whitespace from beginning and end of string: */
$buf = trim($buf);
$buf=str_replace("<!-- real content goes here -->", "¬search¬", $buf);
$buf=str_replace("<!-- end main content -->", "¬search¬", $buf);
$bufexplode=explode("¬search¬", $buf);
$realcontent=$bufexplode[1];
echo $realcontent;
}
fclose($fd);