The example on PHP manual shows how you can use stream contexts to send a cookie. Here is the excerpt:
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example.com/', false, $context);
How do you send more than one cookie? Like #1 or #2, or what?
#1
"Cookie: user=3345&pass=abcd\r\n"
#2
"Cookie: user=3345\r\n" . "Cookie: pass=abcd\r\n"
Your Answer
0 answers
Hot tools Tags
Hot Questions
How to set object property (of object property of..) given its string name in JavaScript?
2026-01-04 19:22:22
How to quickly and conveniently disable all console.log statements in my code?
2026-01-04 19:01:32
Does Python support multithreading? Can it speed up execution time?
2026-01-04 18:43:16
How does this "size of array" template function work? [duplicate]
2026-01-04 18:02:00
iPhone WebKit CSS animations cause flicker
2026-01-04 17:44:27
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
Douyin level price list 1-75
20417
7
20417
7
wifi shows no ip assigned
13577
4
13577
4
Hot Article
How to set up price alerts so you don't miss key entry points?
2026-01-01
By DDD
Why do professional traders advise newbies to start with low leverage?
2026-01-01
By DDD
Tutorial on existence check of nested array values in PHP multidimensional array
2025-12-28
By DDD
How to draw dotted lines in PS How to draw various dotted lines in PS
2025-12-28
By DDD






