LiveJournal and WordPress

So the online Irish gaming community has moved, without a word, to livejournal. They even have a “community” setup.

But to be honest, I’ve already got my own homepage setup so I don’t particularly want to setup another blog just to join in. Well, luckly I found Live+Press, a little plugin for WordPress that allows you to synch blog entires from WordPress to LiveJournal.

I’ve setup a LiveJournal account with the uninspired name “tdo_ie” (thedeadone and many variants have already been taken). This post will actually be the first inaugural post on the account and also be synced on both sites! Lets see if it works… :)

Update: That was a flop. I spent some time trying to debug the plugin but I couldn’t get to the source of why the sync failed. Ah, it was worth a try.

Update #2: So Live+Press sucks but I found LiveJournal Crossposter. Lets see what happens…

Update #3: Still having difficulty but at least with Crossposter the code is much easier to debug. The problem lies with WordPress file class-IXR.php. It has no support for proxies. Seeing if I can hack it a bit…

Update #4: The error is “Something went wrong – -32300 : transport error – could not open socket: 110 Connection timed out”. This comes from the file class-IXR.php from WordPress. AFAIK, my host, Redbrick, does allow outgoing connections. Is this a LiveJournal thing or a Redbrick thing? There are no settings for proxies in either the plugin or the WordPress file.

Update #5: It appears the “110 Connection timed out” is a proxy problem. I hacked class-IXR.php a bit to use the redbrick proxy.

if ($this->timeout) {
//$fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
$fp = @fsockopen(‘proxy.dcu.ie’, 3128, $errno, $errstr, $this->timeout);
} else {
//$fp = @fsockopen($this->server, $this->port, $errno, $errstr);
$fp = @fsockopen(‘proxy.dcu.ie’, 3128, $errno, $errstr);
}

Unfortunantly this isn’t enough. The fsockopen is successful but the fputs isn’t. The error is now: “HTTP/1.0 400 Bad Request”. I’m getting closer at least.

Update #6: Final update. I got it to work!

It requires a further update to class-IXR.php however. The request string that is passed to fputs is missing info that I guess the proxy needs. I needed to add the full url, not just the path and a “http://” to the beginning of the Host field.

$request = “POST http://{$this->server}{$this->path} HTTP/1.0$r”;
$request .= “Host: http://{$this->server}$r”;
$request .= “Content-Type: text/xml$r”;
$request .= “User-Agent: {$this->useragent}$r”;
$request .= “Content-length: {$length}$r$r”;
$request .= $xml;

I guess I better pass this info around!

Related Posts: