rest api fetch doesnt display data

when sending request get to login page instead of showing data

well im new to this so dont know what to try. used echo var_dump but everything is fine

<?php
$username = "*************";
$password = "********************";
$url = "************************************************";

$headers = array(
    "Authorization: Basic " . base64_encode($username . ":" . $password),
    "Content-Type: application/json"
);

$options = array(
    "http" => array(
        "header"  => implode("rn", $headers),
        "method"  => "GET"
    )
);

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);


echo $response;
?>