This seems to work (uses the 'in' operator as I suggested in my comment) :
import pycurl
import StringIO
import sys
import time
ip = "http://www.moorelandpartners.com/plugins/system/plugin_googlemap2_proxy.php"
c = pycurl.Curl()
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(pycurl.TIMEOUT, 10) # Note 1
c.setopt(pycurl.CONNECTTIMEOUT, 10) # Note 1
c.setopt(c.URL, ip)
try:
c.perform()
except Exception:
gg = 88
print "No ",ip
else:
html = b.getvalue()
if "Couldn't resolve host" in html: # Note 2
print "{0} FOUND ".format( ip ) # Note 3
else:
print "do not works"
What I did :
- Note 1 : Increased the timeouts - for some reason the setting of "1" didn't work for me
- Note 2 : used the 'in' operator to test that the returned page contained the words we are looking for.
- Note 3 : removed references to bcolors.OKGREEN and bcolors.ENDC as your bcolors was not defined.
When I tested this on my pc it "worked" - i.e. it stated that it found the web page, and it found the relevant text.