mahaidery mahaidery - 1 year ago 232
PHP Question

Curl to prompt a User Name and Password

I have a password protect web folder on my site, I am fetching that folder on another domain using

, 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".


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
ask for the User/Password prompt.


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"

Answer Source

Thanks all of your responses!

This is what I need, hope it helps someone!

In Order to get the "password protected" URL/Folder via CURL, we need to supply the username/password into the CURL like an example @pizza said, But there are 2 more things.
1-) We need a Prompt Here.
2-) We Don't want to HardCoded the username and password on second domain.

so, we will place PHP_AUTH_USER and password prompt at the top of the page, and then will pass the argument via CURL to the destination URL/Folder.

Yes yes, I know it's simple, but sometime you just can't figure out on a correct dimensions..

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download