Remove use of deprecated ereg() in favour of preg_match() or basic string funcs
Use multibyte safe string functions
Handle cases where HTTP lib has no dns or connectivity