Auto submit a form via cron

Discussion in 'Programming' started by keliix06, Jan 9, 2007.

  1. #1
    I have a form setup that populates itself from some database values and submits itself using JavaScript. The script itself works fine, no problems there.

    The problem is I need to run the script via a cron job and Lynx doesn't support JavaScript. This is a Linux/cPanel system.

    Tried running it through PHP using /usr/bin/php /path/to/script.php and it parses everything correctly, but doesn't submit the form.

    Anyone know how I might go about accomplishing this?

    Thanks
     
    keliix06, Jan 9, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    just rewrite the php to pupulate it's variables from a database and use cron to execute that instead.

    so instead of
    
    <html>
    <?
    //php
    ?>
    <!-- FORM -->
    </html>
    
    HTML:
    you'll just have,
    
    <?
    include("db.php");
    $res = mysql_query("SELECT * FROM `whatever`") or die(mysql_error());
    while($temp = mysql_fetch_assoc($res)):
    
    // do stuff with the data, post to another site or whatever
    
    endwhile;
    @mysql_close();
    ?>
    
    PHP:
     
    krakjoe, Jan 10, 2007 IP