|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-06-29 11:50 UTC] rasmus@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 09:00:01 2025 UTC | 
Description: ------------ When making an HTTP 1.1 request using fsockopen, the response returns some numbers at the beginning and the end of the response data returned by fread that seem like it is debug data, probably the number of unread bytes. If the request line specifies HTTP 1.0, the problem does not occur. This problem prevents making HTTP requests to servers that require protocol 1.1. Reproduce code: --------------- <?php $host="www.php.net"; $port=80; $socket=fsockopen($host,$port,$error); if(!$socket) { echo "socket opening error\n"; exit; } echo "connection opened\n"; $request="GET / HTTP/1.1\r\nHost: www.php.net\r\n\r\n"; if(!fputs($socket,$request)) { echo "socket writing error\n"; exit; } while(!feof($socket)) { $data=fread($socket,1000); if(!$data) break; var_dump($data); } fclose($socket); ?> Expected result: ---------------- The actual page headers and content Actual result: -------------- Some numbers appear before and after the page content data.