Cronjob with password protected site (.htaccess)

I want to create a cronjob so that every X time opens a web page.

This web page is password protected with .htaccess (user = admin, passwor = pass). The instruction I give is as follows:

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

But cron gives me the following error:

--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.

I also tried doing:

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

but with similar errors. How can i decide? Thank you in advance for your help.

+5
source share
2 answers

You make a small mistake.

save http: // in front of the url.

You have

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

Change it to

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

Hope this works.

+1

auth url. , URL.

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

, ...

0

All Articles