string requestUrl = "http://www.somewebsite.com/"; // there's actually a url here
HttpWebRequest request =(HttpWebRequest)WebRequest.Create(requestUrl);
using (HttpWebResponse httpWebResponse = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = httpWebResponse.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
string html = reader.ReadToEnd(); // working, I now have a webpage's html
// MatchCollection mCollection = Regex.Matches(html, @"s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g"); this will give an error >> parsing "s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g" - Reference to undefined group number 1.
MatchCollection mCollection = Regex.Matches(html, Regex.Escape(@"s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g")); // no error, but no results as well
foreach (Match m in mCollection)
{
string myNeededMatch = m.ToString();
}
}
}
}
It didn't work out rahmu, it might be a parsing problem ...
Here's the code - perhaps someone with knowledge in C# syntax can help me.