Syntax issue in curl for getting a file from http site

Hi All

I am using curl in my client environment. We need to pull a file from the libraries site. All the files are having perticular URL which can be used to get the files. Only issue is, when we fire that command , it will take to authentication page 1st. once authentication is succed, it will redirected back to that file location.

when i fire this command
** apended "a" before http to avoid making that a URL in this blog

curl -v -L --user <USERID>:<PASSWORD> ahttp://XXXXXXXXX/upload/15872/doc_3409575.txt -o TGT_OP.txt

its showing

location is the authentication site and finally comming out as
Connection #0 to host XXXXXXXXX left intact

Can you please let me know what alternative i can try to acomplish this?

--Thanks in advance

The --user option only applies to simple HTTP authentication, not complex schemes with login pages and cookies.

It may be possible to do this with curl still but how to do so depends on the page in question.