C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » General »

YahooSearch Service


Posted Date: 11 Sep 2008    Resource Type: Code Snippets    Category: General
Author: Shivashankar ChincholiMember Level: Gold    
Rating: 1 out of 5Points: 10



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;
}
}
}


Attachments

  • YahooAPI dll (20926-11554-YahooAPI.dll)


  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    YahooSearch Service  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Example of reference type in C#.Net
    Previous Resource: Removing duplicate value and sort values in string array
    Return to Discussion Resource Index
    Post New Resource
    Category: General


    Post resources and earn money!
     
    More Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use