I have a website that’s main index page requires HTTP basic authentication which is currently done through apache. (This I cannot change)
What I am trying to do is create a PHP page that will relocate to this page using the code below and that will automatically log me on using the username and password already in the script.
Code: Select all
<?php
$user = “bob”;
$passwd = “3he4kwf”;
header( “Location: https://here.there.com”);
?>One possible solution I have tried was:
Code: Select all
<?php
$user = “bob”;
$passwd = “3he4kwf”;
header( “Location: https://$user:$passed@here.there.com”);
?>Another tried solution is:
Code: Select all
<?php
$user = “bob”;
$passwd = “3he4kwf”;
header( “Location: https://here.there.com”);
header(“Authorization: Basic “.base64_encode(“$user:$passwd”))
?>Does anyone have another solution that might work me?
Any extra information will be most welcome!
Neil