Read specific div from HttpResponse
Posted
by
Kishan Gajjar
on Stack Overflow
See other posts from Stack Overflow
or by Kishan Gajjar
Published on 2011-02-22T07:05:36Z
Indexed on
2011/02/22
7:25 UTC
Read the original article
Hit count: 256
I am sending 1 httpWebRequest and reading the response. I am getting full page in the response. I want to get 1 div which is names ad Rate from the response. So how can I match that pattern?
My code is like:
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create("http://www.domain.com/");
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
Stream response = WebResp.GetResponseStream();
StreamReader data = new StreamReader(response);
string result = data.ReadToEnd();
I am getting response like:
<HTML><BODY><div id="rate">Todays rate 55 Rs.</div></BODY></HTML>
I want to read data of div rate. i.e. I should get Content "Todays rate 55 Rs."
So how can I make regex for this???
© Stack Overflow or respective owner