I have a password protect web folder on my site, I am fetching that folder on another domain using Curl
, what I want is: when I try to open the URL it should ask me the user name and password, instead of asking it display the "Authorization Required".
Example:
If I try to access the "a" url it ask me for the user name password. Fine. but it doesn't ask me for the user name and password on "b" (using curl here).
Any Idea?
In Short: I want to make Curl
ask for the User/Password prompt.
Regards
I am not sure, if it is possible or not? but if it's possible so please let me know how, otherwise I will close this as "Invalid"
To make a GET request using Curl, run the curl command followed by the target URL. Curl automatically selects the HTTP GET request method unless you use the -X, --request, or -d command-line option. The target URL is passed as the first command-line option.
To send an HTTP header with a Curl request, you can use the -H command-line option and pass the header name and value in "Key: Value" format. If you do not provide a value for the header, this will remove the standard header that Curl would otherwise send. The number of HTTP headers is unlimited.
Try the following like :
curl -su 'user' <url>
It should prompt password
for the user
Examples:
--user
curl -v --user myName:mySecret http://example.com/foo/bar
-u
curl -v -u myName:mySecret http://example.com/foo/bar
(example for Minh Nguyen see https://stackoverflow.com/a/26826658/3411766)
curl -v -su 'myName' http://example.com/foo/bar
asks for the pw of user 'myName'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With