PHP - file_get_contents ile çerez gönder

0 Cevap

Ben bir durumla (bir lütuf ile, henüz yanıt ile) this Söz açıklanmıştır sahip ilk planı işe gitmiyor gibi, ben kurabiye gönderirken, file_get_contents kullanarak intikal etmiş Bir kullanıcı oturum açmış yanında doğrulamak için.

Şimdi PHP kılavuzda örnek bir çerez göndermek akışı bağlamları nasıl kullanabileceğinizi gösterir. Burada alıntıdır:

Example #4 Using stream contexts

<?php
// 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);
?>

Benim soru 'nasıl daha fazla çerez gönderebilir mi?' Olduğunu # 1 veya # 2, ya da ne gibi?

# 1

"Cookie: user=3345&pass=abcd\r\n"

# 2

"Cookie: user=3345\r\n" . 
"Cookie: pass=abcd\r\n"

0 Cevap