I am performing an HTTP request to populate an iframe by php. Basically, I don't know how to make the basic authentication in the same redirection.
I send the authentication in the header but the page is always asking for credentials with the famous popup -> http://prntscr.com/j0fao9
Code below
$username = "suzy";
$password = "password";
$remote_url = 'http://10.10.10.215:8080/pentaho/api/repos/%3Apublic%3ASteel%20Wheels%3ADashboards%3ACTools_dashboard.wcdf/generatedContent';
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
);
$context = stream_context_create($opts);
function Redirect($remote_url, $context)
{
header('Location: ' . $remote_url, false, $context);
exit();
}
Redirect( $remote_url, false, $context);
Probably, the problem is in the header sentence, any suggestions?
Tks in advance!