This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Monday, October 5, 2009

Google API for Dot Net

http://code.google.com/p/google-api-for-dotnet/


 // Search 32 results of keyword : "Google APIs for .NET"
GwebSearchClient client = new GwebSearchClient(/* Enter the URL of your site here */);
IList<IWebResult> results = client.Search("Google API for .NET", 32);
foreach(IWebResult result in results)
{
Console.WriteLine("[{0}] {1} => {2}", result.Title, result.Content, result.Url);
}

The above not working in vb.net so did the following:
    Public Sub GetGoogleResults()
Dim client As New GwebSearchClient("/* Enter the URL of your site here */") Dim results As IList(Of IWebResult) results = client.Search(txtQuery.Text, 50, Nothing, Nothing, SafeLevel.GetDefault(), Language.GetDefault(), DuplicateFilter.GetDefault()) For Each result As Google.API.Search.IWebResult In results Literal1.Text = Literal1.Text + String.Format("<h3>[{0}]</h3> {1}<br> " + "<a href=' {2} ' target='blank'>{2}</a><BR>", result.Title, result.Content, result.Url) Next End Sub

No comments:

Post a Comment