I am using the simple_html_dom script to parse a value from a website.
My code:
<?php
include('simpleparser/simple_html_dom.php');
$html = file_get_html('http://www.example.com');
foreach($html->find('strong') as $e) // the tag that I am fetching
echo $e->innertext ;
?>
Now, I'd like to run this only once per day as the data, I am parsing updates only once every day.
I've read a couple of articles about the cron task, but can not get it to work. The examples seem to overcomplicate things and are not relevant to my case. My hosting plan has the cron scheduler disabled and no shell access and I don't know how else to set it up.
To create cronjob from the command line use:
#write out current crontab
crontab -l > mycron
# echo new cron into cron file | runs everyday at 22h
echo "* 22 * * * php /full/path/to/script.php" >> mycron
#install new cron file
crontab mycron
rm mycron
To create a cronjob
using Parallels Plesk Panel, take a look at this answer
UPDATE:
I have no shell access and cronjob disabled in my Plesk Panel.
Use a online cronjob https://www.setcronjob.com/
If there's really no way for you to setup a cron job on your hosting - you could also use some online service to trigger your script once in a while.
For example https://cron-job.org seems to do what you need
Attaching a sample of settings they provide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With