I will give an example of a class that can be used as a search engine on your site.
The class uses the Yandex.XML service to work. In free mode, they allow up to 1000 requests per day. Terms of service on
xml.yandex.ruYandex.XML is a service that allows you to make automatic search queries to Yandex and publish its answers on your site in your own design. Yandex search is a quick access to hundreds of millions of documents and images.
With Yandex.XML, you can offer your users:- Search your site (to the extent that this site is indexed by Yandex);
- Searching by network or its part (region, industry), the results of which can be displayed on your website and in your design, and services based on it - Yandex.XML opens up great opportunities for search engine researchers and teachers;
- Search for images published online.
')
This script implements only full-text search.
An example of the script, you can see here:
kolesa.kz/search/?stext=ToyotaInitially, the class was written for the site, whose sources are in ANSI format (windows 1251). Therefore, the code may meet interesting ICONV. The reason for the appearance of such transcoding is the following: the answer comes in UTF-8 and the code itself in cp-1251. And so that as a result of mixing the encodings, there is no SURPRISE, you have to run out.
For work, you can clean up everything, and do as you like. This is just an example.The class does not use any templates for the integrity of the example. So that you can run it right away.
The only thing you need to make sure that:
- you have php5
- hoster allows you to work with sockets
- connected php extension called DOM
- you have registered on Yandex and entered the IP address of your server
- define ( "SEARCH_ADT_QUERY" , "<< url = \" kolesa.kz/content / * \ "" ); - points to your site
The class is located at:
docs.google.com/Doc?id=dcn4jhdv_4gt4qgzfqUPD0 Version of the script from Yandex:
xml.yandex.ru/games/site-search-php.html (thanks to
Normull , when writing a class, this has not happened yet)
UPD1 For which I did not have the strength, but perfectly supplemented
Groove :
For partners of Yandex who have established a search direct on their website, this restriction is removed.
That is, if you give the search results to all of its visitors, provided that there is Direct on the site, no one will ban you.
But if you just collect the issue for example for seo-analysis, the ban is inevitable.
Only about this was meant.