php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tondur at ozemail dot com dot au
New email:
PHP Version: OS:

 

 [2002-08-04 07:46 UTC] tondur at ozemail dot com dot au
<?php
$fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)<br>\n";
} else {
   fputs ($fp, 
"GET / HTTP/1.0\r\nHost: www.example.com\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: www.example.com");
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( ).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-04 08:07 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 13:01:29 2025 UTC