Google Search API – Introduction

An Introduction to google web API web service, using Visual Basic dot Net

  1. Start VS.Net IDE
  2. Create a ASP.Net Web Application.
  3. Right Click on the Solution Explorer and Select Add Web Reference
    Or Project > Add Web Reference.
  4. It Shows an Add Web Reference dialog.
  5. Enter the WSDL path to the URL textbox (“http://api.google.com/GoogleSearch.wsdl”)
  6. Click on the Add Reference button to add web reference to project.
  7. Put a Textbox, a Button on the form.
  8. Following code in the button click.
'Create an instance of google Search Service, returns GoogleSearchResult
Dim _google As New com.google.api.GoogleSearchService
'Create an instance of GoogleSearchResult, to get the search results.
Dim _result As New com.google.api.GoogleSearchResult
Try
'Check API Reference for more details.,Key - Unique key, from google.
_result = doGoogleSearch("key" ,Textbox1.text,0,10, true, "", true, "","","")
'Writing the number of Results found and time required to get the results in seconds.
Response.Write(_result.estimatedTotalResultsCount & " In " & _result.searchTime & " seconds")
Catch ex as Exception
throw ex
Finally
_result = nothing
_google = nothing
End Try

You can get the key from google on request, you need a google account for this.
Here is only a small intro to the google APIs you can impliment a search engine in your site using this.

For more details visit Google API Home Page

This code is in ASP.Net 1.1.

This entry was posted in .Net. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>