I want to use a cron job to load a file which is in the admin area of one of my sites. How do I get round the password protection using the cron? Cheers
How are you trying to access it? Directly in the file system or via an HTTP request to the web server?
Wow you're up to 15K posts now. I'm doing it through cpanel and I'm accessing it with /home/<user>/public_html/admin/file.php
You should be able to access it via the file system. The webserver doesn't have any control over that.
Just giving what you said a go now exam. -> No such file or directory Do I need to put in the HTTP:// before the www?
Hmmm no. If you have a directory say http://www.somesite.com/secret/ That's protected via HTTP authentication, You should be able to log in automatically by browsing to http://usernameassword@www.somesite.com/secret/
No, that's just the URL to go to in your cron tab. A cron job might look like this: 12 20 * * * root curl "http://username:password@www.somesite.com/secret/s.php" Code (markup): If you have curl installed, this will call the s.php script every day at 8:12 pm Teh *** stands for day, month and weekday respectively.
I just put them in the cpanel I tried using curl before but gave up lol. If I can't get it to work in cpanel I'll give that a go. Thanks again exam. The solution is chmoding the file to 700 and putting php in front of the path to the file. So it would be; php /home/cpanelname/public_html/admin/file.php