I'm going crazy so any help you can give will be a great help. Here is what I am trying to do. I have a webpage saved to my harddrive. It is saved as a text file (I viewed 'source' in IE and then saved it). Of course this file contains html. I am trying to use eregi_replace to replace certain parts of the text. here is a copy of my PHP code.
//$text = ">blue@email.unc.edu<>valerie@email.unc.edu";
$blue = fopen("f:\chapelhillreview.com\test.txt","r");
$text = fpassthru($blue);
$text1 = ereg_replace("<", ",", $text);
$text2 = ereg_replace(","," ",$text1);
$explode = explode(" ", $text2);
//echo $text2 to see if page text is altered
echo ("$text2");
$num = count ($explode);
for ($count = 0; $count < $num; $count++) {
if (ereg(".+@.unc.edu$", $explode[$count], $arr)) {
echo("$arr[0]<br>");
}
}
What I eventually want to do is extract the email addresses from this and eventually write them to a new text file. Notice how the first line is commented. This is my test text to be sure that my eregi_replace functions are working. The code works PERFECTLY when I use the test code. but when I use fopen() and fpassthru() to open the text, nothing happens and the screen output is a webpage instead of altered text, like I want. I'm not sounding to clear, but hopefully someone understands the situation. thanks in advance for the help.
blue