florianstaicu,
Please use the forum's search feature.
This was already asked (quite a few times) here, and there are links to valid tutorials.
In addition, I will provide 2 caveats:
- If this is a school project, you shouldn't be asking here. If you follow a project you are using someone else's code as your own, which is NEVER the intention of the tutorial, nor is it the intention of whomever releases source code to the public -- it is afterall, not your code, its theirs.
In short - do you own homework.
- Keep in mind PHP should never be used as a crawler, generally you will write a crawler in a compiled language, such as C/C++, there is a huge efficiency difference.
--
Here are some tips if you want to do this yourself (or mostly at least)
- You can use cURL to grab contents of a web page, its in the PHP manual
- You can store the results in a Database, such as MySQL (lots of info there)
- You can use a FULL TEXT search to mimic how search engines work (Boolean searches make it more powerful)
have your crawler look through an array of websites (this should be GOOD ENOUGH for school), grab their content, and save it in the MySQL database.
You can use a full text search to find the results.
From there - you can find methods to extract portions of text to show some of the webpage in the results listing.
If you start to write your OWN code, and need some help, feel free to post here and many members will be willing to help.