Searching a file
| From: | Stephen | Date: | Wed, 23 Apr 2003 01:33:06 +0000 |
| Subject: | Searching a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144934@lists.php.net to get a copy of this message | ||
I have some hosted sites and would like regularly check to make sure they have my ad code on each
page. What I'm doing is having a corn job open a check script every week or so to make sure
that each file of theirs has the code.
My trouble is actually searching the file. What I'm doing right now is getting an array of
files in the root directory then will do a foreach function looping through the array of files. I
then open the file in the array part it's looking at in the loop and then I just don't
know what to do. I have the file open, how do I make sure that somewhere in that file it has the
code required?
One last question also. Is there anyway I can filter out extentions of certain files? I obviously
don't want gif, js, or whatever else type of file they might have in there root folder. I only
will need .php, .html, ..htm, .shtml, and so on...
Thanks,
Stephen Craton
http://www.melchior.us