views:

587

answers:

2

Now that Google's discontinued their SOAP API, what can I use to search from C# code... I know they have an javascript ajax API, I've implemented it and it works, just need to do the same thing but from back end code.

Thanks,
Matt

+2  A: 

The AJAX API has a RESTful interface. Have a look here in the section titled "Flash and other Non-Javascript Environments"

Gray Area
A: 

This is a piece of code, just for the record:

var searchTerm = "ABCD";
using (var web = new WebClient())
{
    web.Headers.Add("Referrer", "http://your-website-here/");
    var result = web.DownloadString(String.Format(
           "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={0}&key=your-key-here", 
           searchTerm));
    Console.WriteLine(result);
}
shayan