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
 [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 01 22:03:34 2021 UTC