|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18731 fputs( $sock, $str0 ). $str0 needs to have '\n' to work properly.
Submitted: 2002-08-04 07:46 UTC Modified: 2002-08-04 08:07 UTC
From: tondur at ozemail dot com dot au Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.2.2 OS: Win2k/Winnt v4sp6
Private report: No CVE-ID: None
 [2002-08-04 07:46 UTC] tondur at ozemail dot com dot au
$fp = fsockopen ("", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)<br>\n";
} else {
   fputs ($fp, 
"GET / HTTP/1.0\r\nHost:\r\n\r\n");
   while (!feof($fp)) {
       echo fgets ($fp,128);
   fclose ($fp);
This will work but if fputs( ) is this
   fputs ($fp, "GET / HTTP/1.0\r\nHost:");
ie no "\r\n\r\n", then fgets( ) will block and the code will timeout.
On the server side, the "GET / ..." is read, but will block on the send( ).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-04 08:07 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 18:05:57 2022 UTC