2
我想用密碼保護我的域名,因爲我只是用它來測試腳本,但我需要允許curl HTTP POST請求。這可能嗎?.htaccess密碼驗證,但允許發佈請求
當前的.htaccess:
#AuthUserFile /home/domain/.htpasswds/.htpasswd
#AuthType Basic
#AuthName "Protected Domain"
#Require valid-user
PHP捲曲請求
$handle = curl_init('http://wwww.domain.com/cgi/mailScript.php');
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $serial);
curl_exec($handle);
PHP錯誤:
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Additionally, a 401 Authorization Required error was encountered while trying to use an ErrorDocument to handle the request.
編輯:我不擔心安全問題儘可能只是防止人從探索該網站。
你爲什麼不通過curl請求登錄? – SLaks 2013-05-12 15:05:47
這甚至沒有發生在我身上,我會研究這一點。 – chuckieDub 2013-05-12 15:07:48