#1
  1. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    16

    Automatic execution of PHP to update MySQL?


    Hi

    I dunno if this is the right place to ask but I think it is
    I have a PHP script which gets intel from the internet and stores it in a MySQL database. Getting the intel takes quite a while and needs to be done every 6 hours (can be 12 maybe but that's not important). Problem is, since it's a webpage which gathers the intel I have to trigger it automatically.

    So my question would be is it possible to run a PHP script automatically? (say everyday at 6am and 6pm?) I've heard something about cron-jobs (?) in Linux but since I don't know that much about linux I have no idea how to use that.. Anybody has some experience with this or knows how can do this in another way?

    (The data I collect are 150+ url's from which I analyse the numbers and strings I need and put them in several fields of my table) If I need to be more specific let me know plz!

    Thanks!
  2. #2
  3. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    Search this forum for cron and you'll find plenty of info about cron, at, lynx, wget, php and how to do it...
    But yes, it's possible. Create a crontab to call you php page through lynx or wget to have a scheduled update of your db.

    //NoXcuz
    UN*X is sexy!
    who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep
  4. #3
  5. phpkid ~~~~~~ :o)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Nov 2000
    Location
    NJ, USA
    Posts
    2,534
    Rep Power
    17
    yeah cron job can do that thing for you.

    and try searching forum for cron job and you may find an example. anyways i would move your thread to linux guessing that you are on linux machine.

    jd
    _____________________________
    d.k.jariwala (JD)
    ~ simple thought, simple act ~
    I blog @ http://jdk.phpkid.org
  6. #4
  7. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    16
    thanks for the quick replies..
    I did search for 'automatic', 'update', 'mysql' but I forgot cron

    well, actually I'm on a win2k machine myself but I have a webspace on linux somewhere.. wondered whether there was something with php able to do the job
  8. #5
  9. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    On windows you could use the schedule service with AT to schedule a job like this. But then you can't use lynx or wget (don't think there are any ports to win32), but with PHP as a CGI, you should be able to call the page that does the update.

    //NoXcuz
    UN*X is sexy!
    who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep

IMN logo majestic logo threadwatch logo seochat tools logo