php.net |  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
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: jille at hexon dot cx
New email:
PHP Version: OS:

 

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

<?php
$opts = array(
  "http" => array(
    "method" => "GET",
    "header" => "Cookie: foo=bar",
    )
);

$context = stream_context_create($opts);

$result = file_get_contents('http://example.com/server.php', false, $context);
?>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 06:03:33 2021 UTC