server not sending custom header values

Posted by egza on Stack Overflow See other posts from Stack Overflow or by egza
Published on 2012-07-07T03:12:10Z Indexed on 2012/07/07 3:15 UTC
Read the original article Hit count: 174

Filed under:
|

I'm using PHP 5.2.17 to get a remote page, the HTTP requests contains some cookie values but cookies are not delivered to the destination page.

$url = 'http://somesite.com/';
$opts = array(
    'http' => array
        (
        'header' => array("Cookie: field1=value1; field2=value2\r\n")
    )
);
$context = stream_context_create($opts);
echo file_get_contents($url, false, $context);

Can you help me find the problem? Note: I can't use curl. Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about http-headers