Curl: provide user and password for apache.htaccess file

I use cURL to test some RESTful APIs. Some of these APIs are served from the Apache machine and are protected by a combination of users and passwords using simple .httaccess files.

Is there a way to provide cURL a combination of username and password as arguments?

+7
curl .htaccess apache2
source share
2 answers

Use this curl function for the command line

 -u "User:Password" 

More information about this parameter can be found in here .

+13
source share

You can use this curl command, for example:

 curl -A "Mozilla" -L 'http://user: password@localhost /api/someapi.php' 
+2
source share

All Articles