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!
Comments (10)
An interesting fix. My suspicion is that most people are having problems due to Safe Mode being turned on, and I just don’t have a way around that one. I’ll hold on to this, although I wish we could come up with a better way than hacking WP-core.
I hate to be the nosy idiot that can’t solve his own problems, but this looks like the best reference for Crossposter issues. Any ideas about this one?
Something went wrong – -32300 : transport error – HTTP status code was not 200
I appreciate your help.
Hi Lee, I’m afraid my error was not the same so I’m not sure if I can help.
If I were you I’d check with your host provider and ask them if they allow out bound connections, if there is a proxy and/or is safe mode enabled for PHP.
Your error message above indicates that it is during the “fgets” rather than the “fsockopen”, which was my problem. So I’m assuming it’s not to do with a proxy. This means my solution won’t work.
If you plan to do some of your own debugging (the error message isn’t actually that informative), you can do a number of things.
You can enable debug in the plugin by opening lj_crosspost.php in a decent text editor and looking for this line “$client->debug = false;”. Change it to “$client->debug = true;”. This’ll give you more output, but may not be enough to diagnose the problem.
You can also add debug to the file class-IXR.php in your wordpress installation (under the wp-includes directory). Open the file in a text editor and search for the number of your error i.e. “-32300″. Heres one simply suggestion, change the line:
$this->error = new IXR_Error(-32300, “transport error – HTTP status code was not 200″);
to:
$this->error = new IXR_Error(-32300, “transport error – HTTP status code was not 200: $line”);
This will print out a useful message about the failure, which might help you figure out why you can’t make outbound connections from PHP.
Hope this is helpful,
Mark
(Trivial comment spam defense) Please type the word
Hey, Lee. (even though this post is a bit dated, might as well offer help to those suffering the same issue since this is the first Google result regarding this issue)
I came across this site after having the same permissions error when trying to X-post to LJ. I changed nothing yet it seems that it was something related to /wp-includes/js/tinymce/tiny_mce_gzip.php requesting a nonexistent file. Seems as if I untick that box in WP’s Reading options in regards to compressing posts to gzip, it solves the problem without having to debug if you’re lazy like me and you’d rather your readers wait a bit for their slower browsers/connections to load posts.
Hope this helps!
-Z-
what if the proxy requires authentication? what part of the code should i change? coz i tried changing the codes like what mark did, but the error changed into:
Something went wrong – -32300 : transport error – HTTP status code was not 200
maybe it’s because my proxy requires authentication…so how will i fix the code?
i’m a noob in these kinds of stuff….
I’m afraid I don’t really know. You should do some googling around PHP proxy authentication and how its done and update the two hacks above to handle it.
$request .= “Content-length: {$length}$r$r”;
$request .= “Proxy-Authorization: ” . “Basic ” . base64_encode_ (‘username:password’).”\r\n”;
$request .= $xml;
i added some codes….but whenever i post it just returns a blank page.
this is what i got from googling, i donk know what’s wrong with it.
btw,i changed the username and pass with my own…
Works like a charm! Under WP 3.2.1, the syntax has slightly changed for your update #6:
In function query(), change line 642 (at least that’s what my editor says) to:
$request = “POST http://{$this->server}{$this->path} HTTP/1.0$r”;
But thanks a lot for your thorough commentary, it was a life-saver for me!