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.

Recommended Answers

All 3 Replies

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


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 :(

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();


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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.