John Davidson

Can't get my cURL Cron Job to initiate a PHP script

0 comments
Message:


I'm new to writing Cron Jobs and I can't seem to initiate my PHP script. My current Cron looks like the following:


/usr/local/bin/curl http://{my-url}/ajax.php?cron=execute

I figured I could use a string query and cURL to execute the specific function in my ajax.php file, as such:


if(isset($_GET['cron']) && $_GET['cron']=='execute'){
populate_new_csv();
}

The populate_new_csv() function is currently executed with an AJAX function on the front-end to pull data from an API and generate a .CSV file populated with that data. I'm trying to make this work with a cron job as well but It's a little out my knowledge so any help would be incredibly appreciated.



My Answer:
I help you with something specific?

Rate this post

4 of 5 based on 8556 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us