Running Password Protected PHP file via cron?

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
nparekh
Forum Commoner
Posts: 31
Joined: Fri Aug 05, 2005 2:35 am

Running Password Protected PHP file via cron?

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

normally, you can add the username and password to the url:

protocol://username:password@domain:port/path/file?query#hash
nparekh
Forum Commoner
Posts: 31
Joined: Fri Aug 05, 2005 2:35 am

Thank You

Post 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
Post Reply