I ended up just going ahead and writing the script in Perl using the
DBI module. I had to rework some things (a lot of the date functions)
but it wasn't too hard
Ya know, that brings up Yet Another Solution. Clearly, the output from
the PHP page run from cron doesn't matter, so you don't even need to
retrieve it. Therefore, if you'd rather just program in PHP, you can just
write a short wget in Perl if you don't already have it on your system--
usage: wget.pl [page [host [port]]
'host' defaults to 127.0.0.1 (i.e. localhost) on the assumption that
you'll be running the cron on the same box as the webserver.
'port' defaults to 80, so usually you can just say:
wget.pl /my_php_background_process.php
warning! perl ahead!
#!/usr/local/bin/perl
require 5.002;
use strict;
use Socket;
$host = ($ARGV[1] eq ''? '127.0.0.1' : $ARGV[1]);
$port = ($ARGV[2] eq ''? 80 : $ARGV[2]);
$page = ($ARGV[0] eq ''? '/' : $ARGV[0]);
$proto = getprotobyname('tcp');
if ($host =~ /[0-9]+.[0-9]+.[0-9]+.[0-9]+/)
{
$iaddr = inet_aton($host);
}
else
{
$iaddr = gethostbyname($host);
}
socket (SERVER, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
$paddr = sockaddr_in($port, $iaddr );
if ( connect(SERVER, $paddr))
{
send SERVER, "GET $page HTTP1/0\r\n\r\n", 0;
while (<SERVER>)
{
print $_;
}
}
close(SERVER);
eof