We all know that the famous search engine tycoon Google, I personally think that if you don't use Google's search, it is basically not possible, so I personally go to Google.
It is also special like! We also want to take advantage of his powerful features for our system. Google provides us with API details
Http://www.google.com/apis/ Take a look! Below I think about how to use it (very simple, don't joke me). First you should go to Google to apply for an Account! With this account you can use WebService, but an Account can only use 1000 times a day! I want to say something for me or
It is enough. Second, we can add a web reference in our project ("Project" in the menu can see "Add Web Reference ...") Inside the address:
Http://api.google.com/goGooglesearch.wsdl Post "Refresh" After seeing the WSDL file, you can determine! As for what agent, VS is given to you :-)! In use
Add the following reference using google.com.google.API; there is a 4 classes under the namespace: DirectoryCategory, GooglesearchResult,
GooglesearchService, ResulTelement. We write private googleasearchService WebService = null in the page class; a field, we are using
It can be used directly to instantiate it. As for the specific way inside, you can refer to the Reference section of http://www.google.com/apis/. The last is to use, first we want to instantiate the object WebService (); in the 4 classes mentioned above
GooglesearchResult is to return the result. We bond a GooglesearchResult WebResult = NULL; and use the following statement to search for try {WebResult = WebService.Dogooglesearch (txtKey.Text, TxtKeyword.Text, 0, 10, False, ",", ",", "," ;} catch (Exception EX) {this.response.redirect ("Error.aspx? info =" ex. subssage);} then we can use
ArrayList (); string tmp = ""; for (int i = 0; i
Write the result to an ArrayList or HashTable or in DataTable, then bind directly to DataGrid!
Google seems to limit the number of searchs to 10! The above is no more than yourself! I hope that everyone can help and hope that everyone can work together! The following is a few web pages for Google API, I think there is something better than me! Http://www.msdna.net/resources/display.aspx?resid=1536http://www.c-sharpcorner.com/code/2002/nov/googlesearch.asphttp://www.msdna.net/Resources/ Display.aspx? Resid = 2161 http://www.bbits.co.uk/pubs/Articles/goGooglesearch.aspx's first time!