This code is for YahooSearch Service from .Net application, pass the search string and then get the search result in string array. The YahooAPI dll attahched please add reference in your application.
using System; using System.Collections.Generic; using System.Text; using YahooAPI;
namespace SearchIds { class YahooSearch { public string[] SearchYahoo(string strSearch) { YahooSearchService yahoo = new YahooSearchService(); string[] searchResult = null; int count = 0; try { YahooAPI.WebSearchResponse.ResultSet resultSet = yahoo.WebSearch("Search", "" + strSearch + "", "any", 100, 0, "all", false, false, "en"); if (resultSet.Result != null) { searchResult = new string[resultSet.Result.Length];
//get all result in one string array i.e. searchResult foreach (YahooAPI.WebSearchResponse.ResultType result in resultSet.Result) { searchResult[count] = result.Summary.ToString(); count++; } //Resize the array to specified size.. int getnull = Array.IndexOf(searchResult, null); if (getnull > -1) Array.Resize(ref searchResult, getnull); } } catch (Exception ex) { throw ex; }
return searchResult; } } }
AttachmentsYahooAPI dll (20926-11554-YahooAPI.dll)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|