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. 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. 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);
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.