Jump to content

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/220660-error-using-php-script-to-run-crontab/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.