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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Thu Jan 23 05:01:24 2020 UTC