PHP simple parser to run only once a day

I am using a simple_html_dom script to parse a value from a website.

My code is:

<?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 would like to run this only once a day as data, I analyze updates only once every day.

I read a couple of articles about the cron task, but I can't get it to work. The examples seem to complicate things too much and are irrelevant to my case. In my hosting plan, the cron scheduler is disabled and there is no access to the shell, and I do not know how else to configure it.

+5
source share
4 answers

You can contact your hosting server, but a temporary solution to this problem is to use the cronjob service, there is a lot of free cronjob service on the Internet. You can try these services.

I used this type of service when creating the DDoS ..: p .. bot

You can use these cronjob services, but there are more ...

do a google search using the "Cron job" service, you will find thousands of services such as

Happy coding :)

+1
source

To create a 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 , check out this answer


UPDATE:

I do not have shell access and cronjob is disabled in my Plesk panel.

Use online cronjob https://www.setcronjob.com/

+3
source

If you really don't need to set up a cron job on your hosting, you can also use some online service to run your script once in a while.

For example https://cron-job.org seems to do what you need

Attaching a sample of the settings they provide

enter image description here

+2
source

I am using a windows task schedule. To execute the .php script, you can either paste it like this or create a .bat file and execute it there.

0
source

Source: https://habr.com/ru/post/1233664/


All Articles