Is there any way that i can verify the contents of a page, if they exist in it? like if i open google.com, if its page content has "Error" in it, then i can know that the page is not opened correctly. (i already know the ways to check the page status codes check, like 200, 400 ,404 or 500 etc), i am actually interested in getting and comparing the content of a page against a string and take required action based on that string
Asked
Active
Viewed 1,023 times
1 Answers
2
I am not sure how you can dump formatted web file using curl. If you simply use curl to download the site, and do a string search in it, you might end up getting the wrong result. All the html tags, javascript codes... will be searched.
You might try using lynx
, textual command line browser, with the -dump
option set to format the output and then do grep
to find a string match.
root@localhost:/t# lynx -dump www.google.com | grep -i "Feeling Lucky"
Google Search I'm Feeling Lucky [12]Advanced search

Daniel t.
- 9,291
- 1
- 33
- 36
-
Thanks :) Sometimes the solution is just near us, but we think somewhere else, far beyond for it.. – Farhan Mar 15 '13 at 15:43