1

is it possible to set USERPWD while using stream_context_create?

I have tried like that

$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header' => "Authorization: Basic " . base64_encode("$username:$password")                 
  )
);

$context = stream_context_create($opts);

I'm just wondering is it the correct equivalent? and is base64_encode required?

JackSmith
  • 85
  • 1
  • 10

0 Answers0