jrman006 Posted December 4, 2010 Share Posted December 4, 2010 My host doesn't allow me to setup a crontab via SSH. So I have to use the schedule tasks option my hosting service provides. So I made a php script file and put the below code in it. #!/usr/local/nf/php5/bin/php <?php function process_queue() { //variables $url = "http://www.mysite.com/rotator.php?page=processqueue&login=USERNAME&password=PASSWORD"; $url = "http://www.mysite.com/cron.php?server_id=1"; $url = "http://www.mysite.com/autocrop.php?server_id=1"; $url = "http://www.mysite.com/check.php?server_id=1"; //open connection $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); //clean up curl_close($ch); return $result; } $result = process_queue(); ?> This code seems to work. However it tells me that it couldn't access the site because of password error, etc. But I have the right username and password. This is what the email says: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>401 Authorization Required</title> </head><body> <h1>Authorization Required</h1> <p>This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p> </body></html> I copied this URL into the address bar of the browser and it still asked for a username and password. http://www.mysite.com/rotator.php?page=processqueue&login=USERNAME&password=PASSWORD Got any ideas?? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/220660-error-using-php-script-to-run-crontab/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.