|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60482 Add cookies to stream_context
Submitted: 2011-12-09 14:48 UTC Modified: 2012-12-23 17:44 UTC
From: jille at hexon dot cx Assigned:
Status: Not a bug Package: Streams related
PHP Version: Irrelevant OS: n/a
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jille at hexon dot cx
New email:
PHP Version: OS:


 [2011-12-09 14:48 UTC] jille at hexon dot cx
I think cookies would be a usable addition to the possibilities of stream-context's.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-11 16:18 UTC]
It is trivial to add cookies by adding Cookie: headers.
 [2012-12-23 17:44 UTC]
-Status: Open +Status: Not a bug
 [2012-12-23 17:44 UTC]
This can already be achieved using existing (albeit pretty low-level) 
functionality of the streams API:

$opts = array(
  "http" => array(
    "method" => "GET",
    "header" => "Cookie: foo=bar",

$context = stream_context_create($opts);

$result = file_get_contents('', false, $context);
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 17:01:34 2024 UTC