SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    0 Post(s)
    0 Thread(s)

    CRON or automated task to execute scripts

    I have a number of PHP scripts that I wrote that I use to compile information across the web. I have an unique script for each page that I attempt to get information from, however, since I am trying to execute numerous scripts in a single cron task, it looks like the script is erroring out (and not telling me why).

    This is my current script that I have running every night:

    Code PHP:
    $file = @file_get_contents('');
    $file = @file_get_contents('');
    $file = @file_get_contents('');

    Each of the three scripts are also executable by just visiting through a browser, but they typically take too long to execute or error 500 out.

    What is the correct way to mimic viewing a page through an automated task?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    The Netherlands
    153 Post(s)
    2 Thread(s)
    Since you do this in a cron job I'd go for curl or wget. No need to fire up PHP for this.

    multiple runs are run independently of each other so if one of them crashes all the others still go through.

    /path/to/curl >> command1
    /path/to/curl >> command2
    /path/to/curl >> command3
    It will write the output for each of the "downloads" to the files command1, command2, command3
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts