It's been a while since i've done any coding at all, but i'm about to make a little app that downloads a html file and searches through it for a specific line.
How would i search the file and find the line?
Thanks
Printable View
It's been a while since i've done any coding at all, but i'm about to make a little app that downloads a html file and searches through it for a specific line.
How would i search the file and find the line?
Thanks
Argh. Doesn't matter now, it turns out the request has to be made from a real browser :(
Code:using System;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
string htmlData;
Uri requestUri = new Uri("http://www.google.com");
HttpWebRequest request = WebRequest.Create(requestUri) As HttpWebRequest;
HttpWebResponse response;
response = request.GetResponse() as HttpWebResponse;
using (StreamReader reader = new StreamReader(response.GetResponseStream())
{
htmlData = reader.ReadToEnd();
}
response.Close();
//search the string
Regex regex = new Regex(searchPattern);
Match match = regex.Match();
if (match.Success)
{
Console.WriteLine("found");
}