Log in

View Full Version : php search engine



peejeno
01-30-2007, 09:01 PM
hello all, does anyone know of a good php search engine script that will search files on my server from there meta tag.
or any anything else.
thanks

-peej

djr33
01-31-2007, 01:40 AM
Hm... interesting. I could write that now. But I'm not going to because it would be silly.

It takes a while to search through all of that.

You could:
1. Do a directory listing type search.
2. Store each .htm (etc) file you come across with file_get_contents();
3. Split at the meta tag.
4. Save the metas and filenames/paths in an array.
5. Use a foreach loop to run through the array, using strpos() to determine if the search string does exist*
(*this assumes a single word; you could do more complex looping if need be)
6. Save each match into a new array, including the filename/path.
7. Output the matches' filenames/paths.

But it would take a while.

The better idea is to do the same, but use a database to seed the webpage list (skipping to step 5).