We have a new b2b vendor that wants to use basic auth via URL.
They want to authenticate like this:
//URL coming into our server
http://usernametext:[email protected]/listener.php
How can I get the username and password from the URL via my listener.php script?
I have tried setting basic auth headers per the php man page but it pops up a login box, which is not what I need, since these are web services talking to each other, not people:
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo '<response><error>No username and password found</error></response>';
exit;
} else {
//process request if username & password are legit
}