【问题标题】:Using DDE to get the source of a webpage使用 DDE 获取网页的源代码
【发布时间】:2014-04-01 14:37:12
【问题描述】:

好的。我知道我可以使用 DDE 来获取网页的 URL,甚至可以在 Firefox 等外部网络浏览器中打开特定页面。我想知道获取显示网页的来源需要什么。如果有人可以提供帮助,我将不胜感激。我正在使用 vb.net,但我可以轻松获取任何可用的 C# 示例。我用谷歌搜索,似乎找不到太多。

【问题讨论】:

    标签: c# vb.net dde ndde


    【解决方案1】:

    粗略准备,但是:

    using System;
    
    namespace So2
    {
        class Program
        {
            public static void Main(string[] args)
            {
    
                System.Net.WebRequest req = System.Net.WebRequest.Create("http://www.google.com");
    
                System.Net.WebResponse response = req.GetResponse();
    
                string source = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();
    
                Console.WriteLine(source);
    
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey(true);
            }
        }
    }
    

    【讨论】:

    • 感谢您的回复。我知道您可以使用 Web 请求来获取网页的来源,但我知道网页的特定实例可能具有稍微不同的信息。所以我想在Firefox中阅读已经打开的网页的来源。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多