0

I'm new to PHP and web applications. I have PHP code which collects info, from 5 huge XML files provided by other websites into a private MySQL database.

These XML files are updated and changed over time, and I want my database to be refreshed every day at 3:00 AM.

Can I make the hosting server run the PHP code by itsself? How?

halfer
  • 19,824
  • 17
  • 99
  • 186
Yousif
  • 527
  • 5
  • 23
  • Possible duplicate: http://stackoverflow.com/questions/5766772/using-wget-to-run-a-cronjob-php – Drakes May 02 '15 at 06:32

2 Answers2

1

You can use CRON jobs. Cron will automate your commands on a specific time.

The software utility Cron is a time-based job scheduler in Unix-like computer operating systems.

Read more about CRON jobs

Burning Crystals
  • 1,157
  • 3
  • 19
  • 35
1

As Hobo Sapiens says:

Create a CRON Job

Put a shell script in one of these folders: /etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly or /etc/cron.weekly based on how often you want the script to run.

The shell script should look something like this:

#!/bin/sh
php -q htdocs/file.php

For more specific timings take a look at How do I set up a Cron job?.

If you don't have SSH access to the server, you could also set up a cron job locally to ping the remote server using wget --spider or curl.

Community
  • 1
  • 1
Huey
  • 5,110
  • 6
  • 32
  • 44