How to use Google’s search network resources WebService
We all know the famous Google search engine tycoon found by the capacity, I personally think that if you can not use Google search basically no other possible, so I Google
Is a special favorite! We would also like to use him all the powerful functions of our service. Google has provided us with detailed information can go to Api
Http://www.google.com/apis/ see! Now I would like to briefly talk about how to use the (not very simple joke I).
First of all, you should go to google for an account! With this account you can use an account WebService the day but can only use 1000! I think for me, or
Enough of.
Secondly we can in our projects inside add a Web reference (select menu "project" can be seen in "Add in the Web address used …") Enter:
Http://api.Google.com/GoogleSearch.wsdl the last point "Refresh" to see wsdl file will be able to define the future! As for what you gave Acting VS good :-)! To use it in the
Add the following local references using google.com.google.api; the namespace under the following four categories: DirectoryCategory, GoogleSearchResult,
GoogleSearchService, ResultElement. We write in the inside pages of private GoogleSearchService webService = null; a field, we use
Examples of direct when it can use. As for the specific methods inside you can refer to the reference part http://www.google.com/apis/.
Lastly is the use of the, first of all, we need to use the services of our local examples object webService = new GoogleSearchService (); the above-mentioned four categories
GoogleSearchResult is to return the results. We affirm that a GoogleSearchResult webResult = null; and use the following search phrase
Try (
WebResult = webService.doGoogleSearch (txtKey.Text, txtKeyword.Text, 0, 10, false, "" false, "", "", "");
)
Catch (Exception ex) (
This.Response.Redirect ( "Error.aspx? Info =" + ex.Message);
)
Then we can use
ArrayList al = new ArrayList ();
String tmp = "";
For (int i = 0; i <webResult.resultElements.Length; i + +) (
Tmp = "<a href='"+webResult.resultElements[i].URL+"'>" [i] + webResult.resultElements. Title + "</ a>";
Al.Add (tmp);
)
This.grd.DataSource = al;
This.grd.DataBind ();
Results wrote in an ArrayList or HashTable or DataTable, and then bind directly and DataGrid can be!
Google seems to also limit the number of search for the 10!
These are made by their own Xianlaimoshi! We would like to help at the same time I hope that we can learn together progress!
Here are a few on Google api use the website, I would like to say clearly there than I!
Http://www.msdnaa.net/Resources/display.aspx?ResID=1536
Http://www.c-sharpcorner.com/Code/2002/Nov/GoogleSearch.asp
Http://www.msdnaa.net/Resources/Display.aspx?ResID=2161
Http://www.bbits.co.uk/Pubs/Articles/GoogleSearch.aspx
The first contains a lot!
Tags: google, webservice








0 Comments to “How to use Google’s search network resources WebService”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.