简体   繁体   English

使用DDE获取网页的来源

[英]Using DDE to get the source of a webpage

Ok. 好。 I know I can use DDE to get the URL of a web page, and even open a specific page in an outside webbrowser such as Firefox. 我知道我可以使用DDE来获取网页的URL,甚至可以在外部Web浏览器(例如Firefox)中打开特定页面。 I was wondering what would be needed to get the source of the displayed webpage. 我想知道获取显示的网页来源将需要什么。 If there is anyone who could help I would greatly appreciate it. 如果有人可以提供帮助,我将不胜感激。 I am using vb.net, but I can easily take any C# examples available. 我正在使用vb.net,但是我可以轻松地获取任何可用的C#示例。 I have googled and can't seem to find much. 我已经用谷歌搜索,似乎找不到很多。

Rough and ready, but : 粗糙且准备就绪,但是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM