function lj_ping($un,$pw,$jo,$post,$id,$bblog) {
require_once('XML/RPC.php');
$stuff=array();
// This is bBlog specific. You should alter this
// to work with your engine.
if($post->status == 'draft') {
return;
}
// This is also bBlog specific. You should do whatever
// it takes to get data from your engine.
$pd = $bblog->get_post($id);
$stuff['username'] = $un;
$stuff['hpassword'] = md5($pw);
if ($jo != $un) {
$stuff['usejournal'] = $jo;
}
// This is a hack to format the entry the way I want
// it to be formatted. You should change this or,
// better yet, abstract it properly.
$stuff['event'] = substr(strip_tags($pd['body']),0,250);
$stuff['event'] .= '
';
$stuff['event'] .= '(Read More...)';
$stuff['props']['opt_preformatted'] = true;
// These pieces should be obtained from your engine
// and associated accordingly.
$stuff['subject'] = $pd['title'];
$stuff['year'] = date('Y',$pd['posttime']);
$stuff['mon'] = date('m',$pd['posttime']);
$stuff['day'] = date('d',$pd['posttime']);
$stuff['hour'] = date('H',$pd['posttime']);
$stuff['min'] = date('i',$pd['posttime']);
$lj = New xml_rpc_client('/interface/xmlrpc','www.livejournal.com',80);
// If you have problems, turning this on will help.
#$lj->debug = true;
$msg = new XML_RPC_Message('LJ.XMLRPC.postevent',array(XML_RPC_encode($stuff)));
$res = $lj->send($msg,10);
if($res->faultCode()) {
// This should be done nicer.
print "
LJ ERROR: " . $res->faultString() . "
";
}
return;
}
?>