Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can anyone tell me an easy method of embedding a search engine like Google in C or C++ code
Updated 25-Jun-22 0:16am
Richard MacCutchan 7-Apr-13 3:07am    
You need to use some form of HTTP handler; see
pasztorpisti 7-Apr-13 3:38am    
Your question is not clear, please make it more precise. Do you want to issue a search request and then get back data that can be interpreted by your program or just put an html view (browser) on your window - because these are not the same. The second can be done easily, not sure about the first one. The first can also be an easy task if the google api supports returning results in xml or json or whatever format (I'm pretty sure they support something like this.)
I don't have experience in this but if noone gives you a good answer then try this:
1. Search for a google search client for c++, if you are lucky someone has already written one for you. If not then go on to the 2. point.
2. Write your own c++ client: you will need an http client library that can be used to download the results for a query by url. For example you request GET "" and the http client returns an html page as text for you (depending on the url the returned data can be anything - even binary data and not only text or html). You have to search for the google search api and find out whether they have a query parameter that requests the search results in xml, json or whatever format instead of an html page. On a parameter I mean writing for example "¶m2=value2&xml=1" instead of just "". If the google api has such a parameter then you are lucky because then your request will return data in a processable form instead of a html page so you can process it and use for anything you want in your program.
As a HTTP client I recommend using the cURL library that is a mature file transfer library that knows a lot of protocols for file transfer. One of these protocols is HTTP, you can disable all other protocols when you compile the library. (You can leave the "file" protocol turned on for debugging, in this case curl will accept "file://xyzdsf" links too.)

1 solution

If you are looking for a indexing/search engine in c++ then look at :[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900