SV: SV: Send a cookie with a file_get_contents( ) request?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Anders Norrbring wrote:
> 
> > Thanks Per,
> > I think so too, I glanced it, but unfortunately I have no idea
> > whatsoever about *how* to do it... So, if anyone have suggestions, or
> > concrete examples, please do share!
> >
> > Anders.
> 
> I did play around with it once, but I don't have any actual code to
> share.  Try this though:
> 
> $opts = array(
>   'http'=>array(
>   'method'=>"GET",
>   'header'=>"Accept-language: en\r\n".
>             "Cookie: foo=bar\r\n"
>   )
> );
> 
> $context = stream_context_create($opts);
> 
> $result=file_get_contents( <url>, FILE_TEXT, $context );
> 
> 
> /Per Jessen, Zürich


I'm doing just that now.. ;-)
However, I have 3 parameters set in the cookie, so the question is how to include them all three...
Should I repeat the "Cookie: foo=bar\r\n" three times, like: 

"Cookie: foo=bar\r\n" .
"Cookie: bar=else\r\n" .
"Cookie: time=number\r\n"

Or would I, in some way, add all three on one "Cookie:" line? If so, how do I delimit them? I haven't been doing much with http headers, so all of this is pure experimenting for me..

Anders.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux