I have locked my development-environment with a .htaccess-password.
While I'm now working on a script that uses a cURL-request to that htaccess-protected-folder, it doesn't work. When I delete the htaccess-protection it works fine.
Is there a way to block UserAgents, like GoogleBot and other human requests, but allow cURL ?
You can define the HTTP Auth username and password like this:
curl -u username:password http://...
This way you don't have to disable the HTTP Auth while accessing it from a browser but can access it from your script.
EDIT: If working with the PHP CURL object you can also define it as such:
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
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