Hello monks,
Although I've used the site for tips for about a year, this is my first posting, so excuse me if I am not following correct protocol.
I have a problem that I can't figure out. I am programming in a windows environment, and I am trying to write a simple script that will run several curl commands.
My problem occurs when I run a curl command that needs a response (example "Enter host password for user 'username':").
I can't figure out how to actually send the password to curl.
I've tried several different methods but none have worked for me. Here is a snippet from my latest attempt:
my ($pid, $writeme);
for(0..4){
$pid = open $writeme, "|-",
"c:\\apps\\curl\\curl -u user$_ -X DELETE http://localhost:300
+0/site/users/user$_";
sleep 2;
print $writeme "password$_\r"; #curl isn't receiving this input
close $writeme; #perl hangs here
sleep 1;
}
The password that I send by printing to $writeme isn't being seen by curl for some reason, which leaves curl in a "waiting for input state".
If anyone could show me how I can fix this, I would be immensely grateful.
Thanks!