2

I have a PHP script which uses the value of an form input box to submit a twitter search via FileGetContents(), it returns the results on screen and stores them in a MySQL database.

Here is the form:

<form id="backup" action="backup.php" method="get">
    <div id="formContainer">
        <div class="rowtop">
            <span class="formw">
                <input class="search" type="text" onclick="this.value='';" name="tag" value="<?php echo urldecode($tag); ?>"/>
            </span>
        </div>
                <br>
        <div class="row">
                <br><br>
            <span class="formw">
                <input type="text"  onclick="this.value='';" name="maxpages" value="<?php echo $max_pages; ?>"/>
            </span>
        </div>
        <div class="rowbottom"><span class="label"><input type="submit" value="Backup" /></span></div>
    </div>
</form>

I'd like to have this script running as part of a CRON job, so instead of getting the search value from the input i'd like it to be the same value each time its run.

What is the easiest way to achieve this?

1
  • are just wanting the tweets to update while the user hangs out on your page ? Commented Aug 24, 2010 at 12:54

4 Answers 4

4

killer_PL's code would work... you're just setting the values manually at the start of the script.. an alternative would be to navigate to

"backup.php?tag=XXX&maxpages=XXX"

Sign up to request clarification or add additional context in comments.

Comments

3

If I understood properly your question I would say you simply need the cron job to call directly the script:

backup.php?tag=value_you_set&maxpages=another_value_you_set

In the script you set the values for tag key and maxpages key. You sadi in your question they don't change.

3 Comments

I always get out-posted by a few seconds. Good answer. :) +1
Whoever placed a -1 to my answer could at least post an explanation comment.
Wasn't me.. I actually up-voted. @user257493, It really is the worst of the answers.
2

Cron jobs are running in CLI environemnt, so you should familiarise yourself with this part of manual:

http://php.net/manual/en/features.commandline.php

Comments

-5

Set a few fake $_GET varaibles at begin of a script:

$_GET['tag'] = 'mytag';
$_GET['maxpages'] = 10;
$_GET['Submit'] = 'Backup';

1 Comment

This is probably worst-practices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.