sockets - PHP socket_recv() does not receive the entire response from the server. -


i'm trying receive http response using socket_recv. i'm having trouble responses larger 5000 bytes. stops receiving; without throwing errors; @ 7000 bytes though content-length says response larger (25000 bytes). i'm doing wrong or php sockets unstable?

here's relevant part of code:

 while((socket_recv($this->socket, $buf, 1024, msg_waitall)) > 0){         $this->fullresponse .= $buf;         }  if(!$this->fullresponse){      $errno = socket_last_error();      $errmsg = socket_strerror($errno);      echo $this->state = "{$errno} {$errmsg}";      return;  } 

php sockets ignore content-length headers, because in http response section, , sockets work on lower level. trying http resources? use curl: http://php.net/manual/en/book.curl.php, or if need file that: file_get_contents("http: //www. example.com/ somefile.ext"), work allow_url_fopen must true. found socket_recv comments section on php.net: http://www.php.net/manual/de/function.socket-recv.php#47789


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -