How to build a meta search engine with PHP

meta search engine is a search tool that sends user requests to several other search engines and/or databases and aggregates the results into a single list or displays them according to their source.Currently there are a lot of meta search engine on internet.For example deeperweb.com is a meta search engine which gives the normal search results of google  combined with  results of  ”Answers Search” ,”Metrics Search” ,”News Search” etc.In this tutorial I will show you how to build a meta search engine with PHP .

Meta Search Engine

Meta Search Engine

To build a meta search engine first you need to choose a real search engine and here nothing is better that google.com. Now you need to fetch the content of google search and curl() is the best method for PHP.After fetching the results you need to you need to parse the search results because there are a lot of other things which are useless for you.I have used regular expressions for parsing .After parsing results and exacting main information from content you just need to show the results in your manner.

You can see the demo of my meta search engine script from here.

See Demo

Here is the source of  this meta search engine.

 

You can customize this PHP script by implementing google dork and you can show unique search results .For example if you want to build a video search engine than can use site:youtube.com as a dork to show results only from YouTube.

  • http://www.theidiotspace.blogspot.com/ King_Hermy

    Awesome. I hope you see this comment because i just want you to know that your work has not been in vein. This is exactly the sort of framework i have been looking for. Thank you.

  • clement

    hey i love this site …Thank you sooo much

  • hasan

    I usually avoid the comment section… but your post has made me to burst out….!
    Glorious!
    Thank you very much for your informative, useful and illustrating content.
    Keep it up.

  • hasan

    hi…again!
    your demo site shows results of search query, but upon clicking on search results I am getting error.

    • http://megarush.net/ Amit Singh

      Changed few lines now it will work.

      • TheBrad

        Looks like its down again and Google has changed its search results page code 2 weeks ago. Any ideas?

        • TheBrad

          I got it working by adding the /s to the following line of code: preg_match_all(‘/.+?/s’,$content,$con);

          • http://megarush.net/ Amit Singh

            Well ! looks like syntax of your code in incorrect and you can use Google’s Custom Search API(max 100 search/day) for free for a permanent solution.

          • TheBrad
  • Abdullah

    hellow brother.
    thanks for nice sharing, it was a great work by you.
    bro may u make a Full video tutorial on this topic “Meta Search Engine”
    it will e very help ful for us.
    u just used google for fetching?
    how to add more search agents for fetching results, like yahoo, bing, youtube etc.
    could it be possible to make Meta Search Engine Like Dogpile.com, or mummy.com?
    i am very much trying to find some thing in this context but couldnt find some thing very helpful. could u guide me to right source?

    waiting for ur reply

    • http://megarush.net/ Amit Singh

      Hi Abdullah ! remember this is not a recommended way to build a meta search engine because Google will block your IP after few queries.If you want to build meta search engine then use Google Search API similar APIs you can use for other search engines.At this time Google offers only 100 queries per day for free but if you want to use more queries then you have to pay for it.

  • dom

    Its giving me

    Notice: Undefined index: q in C:xamppNew folderhtdocsexample.php on line 53
    on the front page and it showing

    Notice: Undefined variable: extra in C:xamppNew folderhtdocsexample.php on line 48
    on the results page.
    It only showing 1 result, is it supposed to be showing more results? Can anybody help me?