Orthan URL with basic authentication from external PHP site

I Create a php application to implement some functionalities in my RIS.
I require you from this php application… the URL can be launched with basic authentication so that in a new tab, the given study is displayed.
Launch to URL
http://usuario:clave@ip:8042/study/
http://ip:8042/study/… Using Basic Authentication

The php code that redirects to the orthanc portal doesn’t work at all

I welcome your comments or any guidance

Step 1… My idea is create a session using CURL with basic authentication.
Done correctly
Step 2… launch to the orthanc site to view the study,
but the orthanc app, ask again for the credentials (username and password)

This is a php code example… Do not work

// Initialize cURL session
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $userpass);

$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($result === false) {
$error = curl_error($ch);
echo "Error en la solicitud CURL: " . $error;
} else {
if ($httpcode == 200) {
echo ‘ok’;
echo $result;
// header("Authorization: Basic " . $userpass);
// header("Location: ". $url);
} else {
echo ‘No Auth’;
//
}
}

1 Like