3

I need a cron job to execute the following url

http://www.mywebsite.com/wp-admin/admin.php?page=myvideoblog/mvb_main.php&action=processfeed&updatefeed=67

The problem is that it requires to be logged in as admin, what are my options? I've tried a few plugins but they use hooks instead of just executing a url and the cron jobs provided by the control panel does not log in to the website.

  • 1
    I don't think he is necessarily asking for a plugin, just a solution. – vancoder Jun 26 '13 at 22:34
4

Your option using WP internals would be to use the HTTP API along with wp schedule event

Create a scheduled event, something like:

register_activation_hook(__FILE__, 'my_schedule');
add_action('execute_my_url', 'do_this_daily');

function my_schedule() {
    $timestamp = //some time you want it to run
    wp_schedule_event($timestamp, 'daily', 'execute_my_url');
}

function do_this_daily() {
    wp_remote_get( '../ =myvideoblog/mvb_main.php&action=processfeed&updatefeed=67', $args);
}

This is a simple example please refer to the codex for additional techniques and/or arguments.

It's important to note WP cron only triggers when someone visits your WordPress site, fora true stateless cron you would need to use something at the server level or a better wrapper.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.