Project Description
A .NET 3.5 library of Google Api's.

Current Api's included

  • Ajax Search Api
    • Title (Syntax highlighted or not)
    • Content
    • Url (Escaped, Unescaped, visible (ie. http:// stripped off)
    • Cache Url
    • Estimated record count
    • maximum records to return (with a ceiling of 32 results being the absolute maximum, as decreed by the Google Api).

Quirks about the Google Search Api

  • A maximum of 32 results can be retrieved.
  • The Api call to Google requires a referer site. This value needs to be the website domain name which is accessing the Google Seach Api. I'm not sure why this is required ... it just is. (So that's out of my control). I suppose you can put garbage in there, if you really want to.

Sample C# Code

using System;
using WorldDomination.GoogleApi;


// Retrieve all the star wars results.
Search search = Search.GetSearchResults("star wars", "http://www.Your.Refer.Site.com");
if (search != null && 
    search.ResponseData != null &&
    search.ResponseData.Result.Length > 0)
{
    string title = search.ResponseData.Result[0].Title;  // eg. Star Wars.
    string content = search.ResponseData.Result[0].Content;  // eg. This movie was great blah blah blah ...
}

// Retrieve only 10 results.
Search search2 = Search.GetSearchResults("Kilrathi", "http://www.Your.Refer.Site.com", 10);

Last edited Jun 7, 2008 at 3:14 AM by purekrome, version 7