5 messages in com.googlegroups.bloggerdevRe: [bloggerDev] Error posting to blo...
FromSent OnAttachments
i....@me.net.nz25 Jan 2007 01:16 
Pete Hopkins ☠25 Jan 2007 09:43 
Jonathan Hunt25 Jan 2007 13:56 
Pete Hopkins ☠25 Jan 2007 15:00 
Jonathan Hunt25 Jan 2007 15:21 
Subject:Re: [bloggerDev] Error posting to blogger
From:Pete Hopkins ☠ (phop@google.com)
Date:01/25/2007 09:43:23 AM
List:com.googlegroups.bloggerdev

Bear in mind that www will respond w/ an HTTP redirect, and you will need to re-POST to the URL it sends (your library will likely try to GET this URL, but you want to prevent that default behavior and re-POST).

http://code.google.com/apis/blogger/gdata.html#Add_Entry_Manual_Installed

As for the 401, make sure that you're re-sending the Authorization when you follow the redirect.

-- Pete

On 1/25/07, i.@me.net.nz <i.@me.net.nz> wrote:

Hi,

I'm am trying to post to Blogger (version 2) using PHP (not client library - just PEAR::Request) - and I just can't figure out what I'm doing wrong.

My authentication request (ClientLogin - single user app) look like: POST /accounts/ClientLogin HTTP/1.1 Host: www.google.com User-Agent: PEAR HTTP_Request class ( http://pear.php.net/ ) Connection: close Accept-Encoding: gzip Content-Type: application/x-www-form-urlencoded Content-Length: 104

Email=i%40me.net.nz&Passwd=letme2&service=blogger&source=quarks-mybooks-0.1&accountType=HOSTED_OR_GOOGLE

and I get the expected response with Auth= line - I extract the token. No worries.

I then try to post to my blog with following header POST /feeds/2541079440726803805/posts/default HTTP/1.1 Host: www.blogger.com User-Agent: PEAR HTTP_Request class ( http://pear.php.net/ ) Connection: close Accept-Encoding: gzip Authorization: GoogleLogin Auth=DQAAAG8AAADDMHkynrmujHUTyO2r5S3Kc_ZRRtGG4zbLvHZcDk12DKsvKD1Qfl7ZJ4Thr2jZb05Asm56cE4emKOZ_bzPJ8x_QmVYM-KQACBOROm389DIDwkmfPkt53kwEFzQ0p9rnKRVP9JqD78pTfrTEtZS-NKj Content-Type: application/atom+xml Content-Length: 565

<entry xmlns="http://www.w3.org/2005/Atom"> <title type="text">Marriage!</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">

<p>Mr. Darcy has <em>proposed marriage</em> to me!</p> <p>He is the last man on earth I would ever desire to marry.</p> <p>Whatever shall I do?</p> </div> </content> <author>

<name>jjh</name> <email>i.@me.net.nz</email> </author> </entry>

Which get's redirected once (to www2.blogger.com) and then I get 401 Please use GoogleLogin or AuthSub. User does not have permission to create new post.

Any help appreciated. I really can't figure out what I'm doing wrong. If you want my code just let me know.

Jonny