Page 1 of 1

Running Password Protected PHP file via cron?

Posted: Mon Nov 14, 2005 6:03 pm
by nparekh
Hi guys

I have a script that I run every minute via a cron job.

Code: Select all

curl http://www.mydomain.com/user1/performtask.php
curl http://www.mydomain.com/user2/performtask.php

etc
The problem I have is that I am setting up users on my server with their own password protected directories.

When I run the cron job it says that it needs username password and causes an error. How do I add the username/password tags to the end of the cron job?

Any advice will be appreciated.

Thanks in advance

Nikhil

Posted: Mon Nov 14, 2005 6:11 pm
by feyd
normally, you can add the username and password to the url:

protocol://username:password@domain:port/path/file?query#hash

Thank You

Posted: Mon Nov 14, 2005 6:21 pm
by nparekh
Hi feyd,

Thanks so much!

That did the trick!

I typed in curl http://username:password@mydomain.com/.............etc

and it worked.

Much appreciated.

Regards,

Nikhil