I run numerous blogs, one of which is Wordpress, and I prefer to post to them using Windows Live Writer.
However after a recent update to Wordpress I found I could no longer post with Live Writer or even connect at all in any way, I would get the following error.
the response to the blogger.getUsersBlogs method received from the blog server was invalid
I spent ages Googling for a solution to no avail, but the general consensus is that the problem is caused by an extraneous space or newline in one of the PHP files outside of the <?PHP> tags. I searched all of the suggested files to no avail. So I decided to try and work out the cause myself.
I use a tool called Fiddler to monitor HTTP traffic to and from my computer, so I used this to look at the request and response going from Live Writer to Wordpress.
So with fiddler running I tried to update my account settings, this returns the entire HTML of the entire blog, so is not helpful in determining the cause of the problem, next I tried making a post instead, this returned something more useful and showed me the cause of the problem. To do this yourself, try to post to your blog and then check the result in fiddler in the Inspectors/TextView tabs.
Here is the response that came back from wordpress.
<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><struct><member><name>isAdmin</name><value><boolean>1</boolean></value></member><member><name>url</name><value><string>http://blog.bluethunder.co/</string></value></member><member><name>blogid</name><value><string>1</string></value></member><member><name>blogName</name><value><string>BlueThunder Blog</string></value></member><member><name>xmlrpc</name><value><string>http://blog.bluethunder.co/xmlrpc.php</string></value></member></struct></value></data></array></value></param></params></methodRespons
As you can see the final tag is not closed properly, it is missing 2 characters "e>".
So it would appear that indeed some extraneous characters are indeed being added somewhere which means that the content is not matching the content length, so I decided to see if there was anyway I hack a fix for this as finding these extraneous characters was clearly impossible.
After a lot of searching I finally found a solution.
In the wp-includes folder there is a file called class-IXR.php, and around line 472 you will find the following code which sets the content length.
now as the content is 2 characters shorter than it should be, we want to add 2 to this by changing the highlighted line like so.
header('Content-Length: '.$length+2);
If your content is missing more than 2 characters then add the appropriate value.
Voila, my Live Writer is now able to post to Wordpress again.
Aug 20, 2013 at 12:26 AM Suddenly after the 3.6 release, live writer is no longer able to connect to my wordpress blogs.
Receiving same error as you.
I tried your fix here, but it didn't work.
http://www.damnidunno.com/uploads/ss/MCb.png
Do you have any idea how to resolve this? I'll miss live writer, it made it so simple and easy to public, but maybe its just time to get used to the built in editor.
Aug 20, 2013 at 12:46 AM No idea not had any new issues but then I don't tenf to upgrade unless there is a specific need such as a secutity issue and I always backup so I can roll back if something breaks.
Aug 20, 2013 at 12:51 AM Did you try the same tmethodI mentioned to determine if the content length has changed again. It may require more or less thsn 2 chars this time.
Dec 17, 2014 at 2:31 PM Wow, good catch. This definitely solved the issue for me. Funny thing was Fiddler didn't show the issue, but the WLW log did.