Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

Free Trial Issue of Visual Studio Magazine

email article
printer friendly
get the code
more resources

Add Google Search to Your Site
Create a GoogleBox ASP.NET user control that can add pizzazz to any site.
by Boris Feldman

August 2002 Issue

Technology Toolbox: VB.NET, ASP.NET, XML, .NET Framework

Web services enable you to link disparate systems within an organization or across enterprises. Despite their benefits, the expected avalanche of publicly available Web services that provide functionality to the development community has been slow in coming. Google's recent release of a Web service API for automatic queries using its search engine is a big leap forward. I'll give you an overview of the functionality available through the Google Web service APIs, then show you how to build a GoogleBox ASP.NET user control that you can include on your own site.

Not everyone needs to run automated search engine queries. In fact, you've been able to let your users query Google from within your site for quite a while with only HTML code. In addition, if you need to do automated queries, it has always been possible to use code to pull down results formatted in HTML and then parse them yourself (also known as Web-scraping). However, if the site you're Web-scraping changes its format in any way, chances are your code is going to break. Google's Terms of Service also forbid Web-scraping specifically—perhaps because they don't want other people to parse their search results programmatically without their knowledge—so you shouldn't be doing it anyway.

Besides, with the release of Google's Web service APIs, you don't need to create or maintain such a hack. The Google Web APIs developer's kit is a free download from the Google site and contains everything you need to get started (see Resources). Included are a Web Services Description Language (WSDL) file and some C# sample code to help you on your way.

Web services are cross-platform, and the Google APIs are no exception. If you're using Visual Studio with a third-party language, such as Perl or Python, you can use the Google Web service too. Note that, as of this writing, the Google Web service is a beta product. As such, both the APIs and your access to them can change at any time and without notice.

In addition to downloading the developer's kit, you also need to register your e-mail address with Google. Google then e-mails you a license key you must include as a parameter in all your queries. The key's purpose is to allow Google to know who's accessing its servers and to restrict each user to 1,000 queries per day. Both the developer's kit and the access to the Google servers through the Web service APIs are free for noncommercial use. Make sure to read and abide by the Terms and Conditions established by the company when creating your programs.

Back to top














Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home