开发者

i want to use http authentication for web access, while still allowing cron job access (PHP)

i'm making a unit testing suite. i want to autheticate users using http authentication if they access the tests url via the web, but i still want users 开发者_StackOverflowto be able to set up a cron job that runs the tests automatically. how can I do both?


Have two different scripts requiring the same library. In one script you just run whatever function you want - this is the one you call from crontab. In the other one, you do the auth, then invoke the main function.

All this is even not necessary if you're using basic http auth, and not care about the identity - then .htaccess and .htpasswd are all you need. Apache will check the user, crontab will ignore the auth mechanism.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜