$get = "GET ".$url_path.$query_encoded." HTTP/1.1\r\n";
$get .= "Host: ".$url_host."\r\n";
$get .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; phpSitemapNG ".PSNG_VERSION.")\r\n";
$get .= "Referer: ".$url_scheme.'://'.$url_host.$url_path."\r\n";
$get .= $cookie_string;
$get .= "Connection: close\r\n\r\n";
debug(str_replace("\n", "<br>\n", $get), 'GET-Query');
RIGA 483 socket_set_blocking($fp, TRUE);
RIGA 484 fwrite($fp, $get);
$res = '';
$head_done = FALSE;
$ts_begin = $this->microtime_float();
// source for chunk-decoding:
http://www.phpforum.de/archiv_13065_..._anzeigen.html
// get headers
$currentHeader = '';
RIGA 493 while ( '' != ($line=trim(fgets($fp, 1024))) ) {
$res = '';
RIGA 518 while ($chunk != 0 && !feof($fp)) {
// echo "chunking...<br>\n";
if ($chunk > 0){
$part = fread($fp, $chunk);
$chunk -= strlen($part);
$res .= $part;
if ($chunk == 0){
if (fgets($fp, 1024) != "\r\n") debug('Error in chunk-decoding');
$chunk = hexdec(fgets($fp, 1024));
}
} else {
RIGA 530 $res .= fread($fp, 1024);
}