1

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!

Wal Heredia
  • 401
  • 1
  • 6
  • 14

1 Answers1

0

have you tried using http://username:password@domain.com/...

that way your passing the username and password thru the url.

Henry Wong
  • 105
  • 6