【问题标题】:How to Integrate Yahoo API Search in web-Application using Asp.net如何使用 Asp.net 在 Web 应用程序中集成 Yahoo API 搜索
【发布时间】:2009-02-02 13:04:00
【问题描述】:

我想用 C# 将 yahoo search api 集成到我在 asp.net 中的 Web 应用程序中。 我不知道怎么调用yahoo api。

【问题讨论】:

    标签: asp.net web-services


    【解决方案1】:
    string AppId = "foo";
    string Query = "stackoverflow";
    int NumResults = 10;
    
    WebClient webClient = new WebClient();
    string request = string.Format(
        "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid={0}&query={1}&results={2}"
        , AppId
        , Query
        , NumResults);            
    byte[] response = webClient.DownloadData(request);
    string responseXML = System.Text.UTF8Encoding.UTF8.GetString(response);
    Console.WriteLine(responseXML);

    【讨论】:

      【解决方案2】:

      我不确定它是否仍然有效,但几年前我为此编写了一个 C# 和 VB.Net 包装器。雅虎甚至将它包含在他们的示例代码中。您可以从my site 下载它。基本上,您在从 Yahoo 的开发人员网站获得的 XML 架构上使用 XSD.Exe,然后将您的 Web 请求的结果反序列化为 XSD.exe 生成的对象。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-03-13
        • 1970-01-01
        • 2014-04-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多