Heal Your Church WebSite

Teaching, rebuking, correcting & training in righteous web design.

Last Week’s Treachery

Before the personally tragic events that transpired this past weekend, I was enjoying a seminar on building sand castles and eating ice-cream in a location that was computer impaired.

So how did I manage to get a couple of blogs in last week? Well, using a snippet of code I found at the movabletype.org : Support Forum along with crontab, I was able to post without be present. I even posted that politically incorrect Iraqi TV Guide over at blogs4God – boy did that confuse the moderators !-)

Since the forum mentioned has more than one snippet, here’s the one I’m talking about – only I’ve added some variables for clarity and marked in bold the things YOU need to change to make it work:

#!/usr/bin/perl -w
use strict;

use Data::Dumper;
use XMLRPC::Lite;
my $rpc = XMLRPC::Lite->new;
my $url = “http://localhost/mt/mt-xmlrpc.cgi”;

## Might need to change username and password.
my $username = “ME”;
my $password = “TOPSECRET”;
my $message = qq~
Test Message

This message is a test, had it been an actual message …

# here is where you play with the blogger API
my $som =
   $rpc->call(‘blogger.newPost’ => ”, 1, $username, $password, $message, 0);

if ($som->fault) {
print “[", $som->faultcode, "] “, $som->faultstring, “\n”;
} else {
print Dumper $som->result;

BTW, the result returned is going to be new blog ID number if things work out.
The next step is for me do run this against the database, but I wanted to put this up to show you how tools like XMLRPC::Lite can be coupled with crontab to give you dynamic content even when you’re not near your church’s web site.

Granted, it means using tools that implement some form of the XML-RPC, such as various blogging tools – or rolling your own. Still with tools like XMLRPC::Lite and/or Keith Deven’s XML-RPC implementation for PHP, it’s not too terribly hard once you put your mind to it.

Comments are closed.