I was having a problem that snoopy was not returning
any results in the $results variable, so I took a look
and you are only checking for \r\n to separate the
headers from the body, while apparently you should be
looking for all line break types (\r, \n, and \r\n) so
in your _httprequest function I changed this:
if ($currentHeader == "\r\n")
to this:
if($currentHeader == "\r\n" || $currentHeader == "\r"
|| $currentHeader == "\n")
and everything works now.
Logged In: YES
user_id=1342950
Actually, there is a bug when the headers reading timeouts, the headers are
read into the data results !
This:
while($currentHeader = fgets($fp,$this->_maxlinelen))
{
...
}
$results = '';
do {
$_data = fread($fp, $this->maxlength);
if (strlen($_data) == 0) {
...
should be changed to that:
while($currentHeader = fgets($fp,$this->_maxlinelen))
{
...
}
// 4 lines added to fix problem that on timeout of header, and not
timeout of read-data, data returned includes header:
if ($currentHeader === false) {
$this->status=-100;
return false;
}
$results = '';
do {
$_data = fread($fp, $this->maxlength);
if (strlen($_data) == 0) {
...
Indeed, according to fgets() php.net specs, it returns false on errors (like
timeouts).
Otherwise it sometimes returns the http headers in the data.... !