0

hi everyone.
i just want to know that how can i fetch any paragraph/line written in "p" tag in any website.
i want to recieve a complete article written in any website into my c# window appication.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by zid8ne
0

You can use webrequest method and regex.
This regex can take anything between p tags.

<(?!\/?p(?=>|\s.*>))\/?.*?>
0

Will you please ellaborate ?
i am using Visual Studio 2010. And its web browser from the ToolBox to open the webiste and then getting the Doucment by webbrowser.document .... in this scanario can i use that webrequest and regex? and Sorry i haven't used these both yet, i am pretty beginner in it :(

0
string htmlstring = string.empty;           
HttpWebRequest hwRequest = (HttpWebRequest)HttpWebRequest.Create(Url);

hwRequest.Method = "GET"

HttpWebResponse hwResponse = (HttpWebResponse)hwRequest.GetResponse();

using (StreamReader sr = new StreamReader(hwResponse.GetResponseStream()))
{
    htmlstring = sr.ReadToEnd();
}

hwResponse.Close();

then use regular expression to extract "p" tag in htmlstring

Edited by zid8ne

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.