|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50347 $http_response_header does not get populated by file_put_contents stream
Submitted: 2009-12-01 00:56 UTC Modified: 2009-12-01 08:59 UTC
From: php at hm2k dot org Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.3.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 + 38 = ?
Subscribe to this entry?

 [2009-12-01 00:56 UTC] php at hm2k dot org
When using file_put_contents(), $http_response_header does not populate as expected.

Reproduce code:

Expected result:
array(9) {
  string(15) "HTTP/1.1 200 OK"
  string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT"
  string(29) "Server: Apache/2.2.3 (CentOS)"
  string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT"
  string(27) "ETag: "280100-1b6-80bfd280""
  string(20) "Accept-Ranges: bytes"
  string(19) "Content-Length: 438"
  string(17) "Connection: close"
  string(38) "Content-Type: text/html; charset=UTF-8"

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-01 08:35 UTC]
What exactly are you trying to do? Write to HTTP? 
 [2009-12-01 08:43 UTC] php at hm2k dot org
Your question is already answered by the sample code I provided.

For clarification: file_put_contents() is reading from a URL and writing to a temp file.
 [2009-12-01 08:47 UTC]
Well, your script only writes '' string to the $file.
 [2009-12-01 08:59 UTC] php at hm2k dot org
Ah, touché, I need to open the stream first.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 25 17:01:30 2024 UTC