I want to scan everything that's available on any webpage, then once this is done I want to compare some strings to the content on that webpage. If there's something that is found in common I want to print that it's the correct webpage. For example: when you enter google.com there the "I'm Feeling Lucky" button. In my code I have a string that says the same, I want to compare my string to the text written on screen. If they end up the same, I'll print "Correct Website". How can I do that?
net/http is a good start.
resp, err := http.Get("http://example.com/")
if err != nil {
// handle error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
// explore
// fmt.Println(string(body))
if bytes.Contains(body, []byte("I'm Feeling Lucky")) {
fmt.Println("Correct Website")
}