Hi i dont think i have stored it into memory.... these are the examples that i have been playing with from different sites so far.......
$fh = fopen("web address", "r");
//-----------first example start---------------//
//This works it displays the page
while ($buf = fread($fh, 8192))
print $buf;
fclose($fh);
//-----------first example end----------------//
//------------2nd example start---------------//
// this section i cant tell if it works... it just prints the word white which is the variable
while ($buf = fread($fh, 8192))
print $buf;
echo ("$buf<br />");
if (!preg_match('/<font face="verdana,helv,sans-serif" size=2>/i', $buf, $match)) die("preg_match found no match.");
if (!preg_match('/<body>([^<]*)<\/body>/i', $buf, $match)) die("preg_match found no match.");
if (!$found_comment = $match[1]) die("\$match[1] was not set.");
echo "<p>$found_comment</p>\n\n";
$text = "white";
$improved = preg_replace('/\[([^]]+)\]/', '<font face="verdana,helv,sans-serif" size=2 color=\\1>([^<]*)', $text);
echo "$improved";
fclose($fh);
//------------- 2nd example end--------------------//
//--------------3rd example start-------------------//
function tag_rep($tag)
{
return preg_replace('/(?<!\<)(\S+)\s*=\s*(?<![\'"])([^\s\'"]+)(?![\'"])/','\1="\2"',$tag);
}
$html="<p class=MsoNormal id=par><font size=10 face=\"Comic Sans
MS\"><span lang=NL style='font-size:12.0pt;font-family:\"Comic Sans
MS\"'><a
href=http://www.php.net/index.php> key=value </a></span></font></p>";
echo 'Normal HTML:<br><textarea cols="70" rows="10">';
echo $html;
echo "</textarea><br><br>";
$improved_html = preg_replace('/\<(.*)\>/Ueis','"<".tag_rep("\1").">"',$html);
echo 'Improved HTML:<br><textarea cols="70" rows="10">';
cho str_replace("\\'","'",$improved_html);
echo "</textarea>";
//----------------3rd example end-----------------//
Hope this helps u understand where i am coming from.....
I'm more of a JSP girl to be honest ive just picked up php cos the server working on does not run Tomcat properly... plus never done parsing before but i understand the concept but cant get to grip with the correct php code...
any help will be much appreciated!
Lindsay