Tutorial :How to search wikipedia and get input or info in C++?



Question:

I want my program to search wikipedia and get the info it searches for and put it into a large string and output into a file. How can I do that in C++? Any info please tell? need more anwsers please


Solution:1

Use wget with the query URL

wget --output-document=result.html http://en.wikipedia.org/wiki/Special:Search?search=jon+skeet&go=Go  

This searches for jon skeet and stores the result in result.html

To use it from C++ you can e.g. use the system() call to execute wget in a seperate process.


Solution:2

libcURL is pretty popular. I don't know that the interface is especially object-oriented, but it's certainly usable from C++.


Solution:3

There are a number of client APIs for MediaWiki (the wiki engine that powers Wikipedia). Here's a listing. They provide the ability to create/delete/edit/search articles. Nothing in straight C++ but it still may be useful.

DotNetWikiBot was quite useful on one project that I had...


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »