D
dan baker
I am attempting to POST from one script to another within the same
directory, which happens to be under .htaccess basic_auth . I am kinda
weak on understanding how UserAgent interacts with basic auth, but
have finally got something limping along if I happen to have the
clear-text password for the current user.
what I am wondering is if there is a way for me to set up the request
with whatever the current credentials are for the current user of the
first script? Since the scripts are in the same directory, the same
person should be able to run both scripts. I want to avoid having the
clear-text passwords on the server if I can avoid it.
This is the snippet in question in case there is an easier/better way
to do it...
$ua = LWP::UserAgent->new ;
$req = POST 'http://fullurl.com/...'.'UI_Home.pl',
[
HTML_StartNewOrderError => $HTML_ErrorMsg ,
PatientMRN => $PatientMRN
] ;
$req->authorization_basic( $RemoteUser , $UserPass ); # CLEAR TEXT
PASS
$res = $ua->request($req);
if ($res->is_success ){
print "Content-type: text/html \n\n" ;
print $res->content ;
} else {
print STDERR "\t UserAgent message: ".$res->message."\n";
&ExitToBrowser('fatal',"UserAgent failed \n");
}
exit;
thanks,
Dan
directory, which happens to be under .htaccess basic_auth . I am kinda
weak on understanding how UserAgent interacts with basic auth, but
have finally got something limping along if I happen to have the
clear-text password for the current user.
what I am wondering is if there is a way for me to set up the request
with whatever the current credentials are for the current user of the
first script? Since the scripts are in the same directory, the same
person should be able to run both scripts. I want to avoid having the
clear-text passwords on the server if I can avoid it.
This is the snippet in question in case there is an easier/better way
to do it...
$ua = LWP::UserAgent->new ;
$req = POST 'http://fullurl.com/...'.'UI_Home.pl',
[
HTML_StartNewOrderError => $HTML_ErrorMsg ,
PatientMRN => $PatientMRN
] ;
$req->authorization_basic( $RemoteUser , $UserPass ); # CLEAR TEXT
PASS
$res = $ua->request($req);
if ($res->is_success ){
print "Content-type: text/html \n\n" ;
print $res->content ;
} else {
print STDERR "\t UserAgent message: ".$res->message."\n";
&ExitToBrowser('fatal',"UserAgent failed \n");
}
exit;
thanks,
Dan