Kyle
Kyle

Reputation: 33739

How to search for some text on a webpage?

I have used WatIn before to scrape a lot of data off of websites. I know I could handle this task with that, but I am hoping for a much lighter solution if possible.

I want to be able to go to a URL, and see if the website has the word "open" on it, or if it has the word "closed" on it.

Does anyone have a good suggestion?

Upvotes: 2

Views: 4760

Answers (3)

Daren Thomas
Daren Thomas

Reputation: 70354

Yes. Use the WebClient.DownloadString method and check the page with the standard string methods. This is as simple as it gets.

If you want more, follow @mekici's tip: The Html Agility Pack.

Upvotes: 5

Mustafa Ekici
Mustafa Ekici

Reputation: 7480

You can use html parsing.. Html Agility Pack helps you for this.

Upvotes: 6

Deepesh
Deepesh

Reputation: 5614

Explore HttpWebRequest & HttpWebResponse. You can get the text of page in a string variable and use IndexOf or Contains to get the text

Upvotes: 0

Related Questions