Please be gentle. I've been hunting high and low on how to run a php file with wp-crontrol or within wp-cron. I'd like to find a way to run it like it would run with cron. Here is a sample cron job command>>>>
/usr/bin/php -q /home/username/public_html/mywebsite/wp-content/plugins/wp-posterperiodic/post-cron.php
I'm really stuck. Any help would be appreciated.
Thanks ahead of time!
Frank
Hi Frank,
Something like this written in a PHP hook in wp-crontrol would probably work. I haven't tested it though.
require_once(ABSPATH.WPINC.'/class-snoopy.php');
$snoop = new Snoopy;
$snoop->fetch('http://example.com/wp-content/plugins/wp-posterperiodic/post-cron.php');
if( $snoop->status == '200' ) {
do_something_with( $snoop->results );
}
Cheers,
Edward
Thanks Edward,
Much appreciated. I will give it a wack. Do you think that there is any way to not use a absolute path to the file and instead use a relative path or perhaps use a variable to point to the blog url and make it so I can push it to multiple blogs?
Also, another question, do you know how some of the plugins out there 'humanize' the cron timing. In other words, it will choose a random time once per day between say 9am and 4pm to run the cron?
Thanks!
Frank.
PS, I'll give that script a try right away!