Jump to content

Search without SQL Database


wilorichie

Recommended Posts

What do you mean by "non HTML elements pages"?

 

You can use the dir class to open a directory, the read through the files, select the ones you want, then use file_get_contents to read the file and use strpos and the regex functions to search for your string.

 

http://www.php.net/dir

http://www.php.net/file_get_contents

http://www.php.net/strpos

I have a large site where new pages are constantly being added.

 

I want to be able to automatically search any php file in any directory from /root/ to check if $search matches anything within <body></body> tags that is NOT HTML.

 

What you said sounds like the logic behind it though.

 

The more tips / tutorial / examples the better

 

Thank you for your help though, hitman

Once you get above a few tens of files this process will get very very slow and cumbersome.

 

You may want to look into a CMS or some other method that will store your data in a database that can be easily searched.  You may even consider a cron job that will parse your files and insert them into a database that has a fulltext index set up for the field.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.