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 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 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 as a dork to show results only from YouTube.

  • 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….!
    Thank you very much for your informative, useful and illustrating content.
    Keep it up.

  • hasan

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

    • 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);

  • 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, or
    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

    • 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?

  • Genious

    there is only one result per search on your demo !! how to fix it?

  • Arturo

    Hi that code show me No results found, Helpme please friend!

  • Sobia Farooq

    this code give me a lot help but i have a problem,,, why this is not searching, only go to 1st tab where links appear but not go ahead,, please if you guide then it will be a great help for me ,,