How to access protect folder by apache HTTP Basic Authentication using cURL

Normally if you try to access protect folder by Basic Authentication without proper credentials you will get 401 Unauthorized error:

Example:

curl -s https://yourwebserver.com/mysecure

<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested.

Read the rest