use a stream function to read (had problems with binaries)
performance tweek, getHeader get called only ones now
check variable first, (little improvment)
work only with the response buffer
force there are no line breaks at the end
remove unneeded check
do not trim content if not needed
strpos is much faster then substr
do not use empty function
line was out of braces cause a line commit
do not use empty function and check strim first