7

X 回ごとに Web ページを開く cronjob を作成したいと考えています。

この Web ページは、.htaccess (user=admin、passwor=pass) によってパスワード保護されています。私が与える指示は次のとおりです。

wget --user=admin --password='pass' http://www.mywebsite.com/test.php

しかし、cronは私に次のエラーを与えます:

--2012-05-02 10:14:01--  http://www.mywebsite.com/test.php
Resolving www.mywebsite.com... IP
Connecting to www.mywebsite.com|IP|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Reusing existing connection to www.mywebsite.com:80.
HTTP request sent, awaiting response... 403 Forbidden
2012-05-02 10:14:01 ERROR 403: Forbidden.

私もやってみました:

wget admin:pass@http://www.mywebsite.com/test.php

しかし、同様のエラーがあります。どうすれば解決できますか?よろしくお願いいたします。

4

3 に答える 3

1

あなたは小さな間違いを犯しています。

URL の前にhttp://を付けます。

あなたが持っている

admin:pass@ http://www.mywebsite.com/test.php

に変更します

http://admin:pass@www.mywebsite.com/test.php

うまくいくことを願っています。

于 2016-02-17T23:52:03.860 に答える
0

url に auth パラメータを追加します。これは、URLを直接呼び出すときに機能します。

http://yoururl.ext?auth=id:psw

どこまで安全なのかわからない…

于 2015-02-10T15:00:22.010 に答える