views:

327

answers:

2

Hi ,

I have an application on php-Codeigniter hosted on MediaTemple and I want to have a cron job runing a controller, the support told me to use CURL I tried using without any succes, example:

curl http://mydomain.com/admin/action/get

My controller inserts some information to a database, the curl doesn't display error but the inserts are not happening only when I run the controller directly on the browser works. no auth is required.

any idea?

thanks

+1  A: 

You need to provide more information about what's happening before people can really help you. Please see this helpful guide to asking questions.

Some starting points:

  1. What happens when you run that command from command line?
  2. What happens when you go to the controller URL in a Web browser?
  3. What exactly does your "not any success" consist of? What indications of success are you looking for and what are you observing?
  4. Does your controller require authentication? If so, you will need to tell curl how to supply it. If not, be aware that you're allowing this process to be actuated by anyone on the Internet, which may facilitate denial-of-service attacks or other security issues.
chaos
My controller inserts some information to a databse, the curl doesnt display error but the inserts are no happening only when i run the controller direclty on the browser works. no auth is required.
VictorC
`curl` doesn't display an error; does it display the output produced by the controller? (If there is any, that is. If there isn't, you should probably add some temporarily for debugging.) Like, if you do `curl http://www.google.com/`, you'll see that `curl` should show you the content of the Web page retrieved.
chaos
A: 

Just make a cronactivator.php file, and point your cronjob to this file. No CURL needed.

<?php 
//for php4 use fopen
$html_data = file_get_contents('http://www.yoursite.com/framework/controller/action', 'r');
echo "DONE!";
exit;

?>
your_welcome