embeding Yahoo Search in our applications is very easy .
Yahoo.API.dll can be downloaded from below link
http://developer.yahoo.com/download/download.html
Add this as reference in your solution and use below code:
protected void Search()
{
// Search Code
string strSearch = "web services";
Label1.Text = "Search Result for " + strSearch + " ";
Yahoo.API.YahooSearchService yahoo = new Yahoo.API.YahooSearchService();
Yahoo.API.WebSearchResponse.ResultSet resultSet;
resultSet = yahoo.WebSearch("YahooExample", strSearch, "all", 10, 1, "any", true, true, "en");
StringWriter sw = new StringWriter();
foreach (Yahoo.API.WebSearchResponse.ResultType result in resultSet.Result)
{
sw.WriteLine("{0}
", result.Title, result.ClickUrl);
sw.WriteLine("{0}
", result.Summary);
sw.WriteLine("{0}
", result.Url);
sw.WriteLine("
");
}
txtContent.Text = sw.ToString();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment