Error authenticating Json with php by passing header

Asked

Viewed 110 times

1

I have a small problem when consulting a URL with file JSON. Basically my code returns bool(false).

$usuario = 'root';
$senha = '123';

$header = 'Authorization: Basic ' . base64_encode($usuario . ':' . $senha) . "\r\n";
          'Content-Type: application/json;charset=UTF-8';
opções fornecidas na options predefinição.
$context = stream_context_create(array(
    'http' => array(
                  'header' => $header
              )
    )
);
error_reporting(0);
$arquivo = "https://127.0.0.1:9088/xd/servidor/?serie=2018&?number=424";

$info = file_get_contents($arquivo);

var_dump($info);

If I pass the file name directly instead of the url, for example json file., mine var_dump() normally reads the code, but to access the URL it does not read.

Can someone help me?

Thank you

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.