?

Log in

No account? Create an account
Writing a PHP client for posting to Livejournal - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Writing a PHP client for posting to Livejournal [Mar. 8th, 2007|01:48 am]
LiveJournal Client Discussions

lj_clients

[kosso]
Hi,
I have a system which crossposts to other systems and I am having trouble making a correct post to LiveJournal (btw: the system is for Second Life at http://bloghud.com )

I am able to list users blogs and get the required data to make posts on their behalf and also I am able to make 'a post' -

but the post itself show up as something like : HASH(0xbeb4544)

see: http://kosso.livejournal.com/1446.html

Which makes me think that my content struct is malformed - despite not giving an error.

This is what I am trying to post:

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
  <methodName>blogger.newPost</methodName>
    <params>
      <param>
        <value><string>0123456789ABCDEF</string></value>
      </param>
      <param>
        <value><string>kosso</string></value>
      </param>
      <param>
        <value><string>kosso</string></value>
      </param>
      <param>
        <value><string>xxxxxxxx</string></value>
      </param>
      <param>
        <value>
        <struct>
            <member>
                <name>title</name>
                <value>
                <string>this is a test post title</string>
                </value>
             </member>
             <member>
                <name>description</name>
                   <value>
                  <string>here is the main body of the post. very interesting I think you'll agree</string>
                   </value>
             </member>
        </struct>
        </value>
      </param>
      <param>
        <value><int>1</int></value>
      </param>
  </params>
</methodCall>

I'm posting to the http://www.livejournal.com/interface/blogger endpoint

This is beyond the (limited) documentation over at : http://www.sixapart.com/developers/xmlrpc/blogger_api/bloggernewpost.html

as this only shows how to post to the main body of the post. (ie not as a title/description  or  subject/body ) which I have got working.

So, can anyone out there explain how to create a content struct to contain the title and description?

(I'm new to LJ's system and I have to say the documentation is terrible. This is also why I'm having trouble support MT too)

I was even able to write support for the new Google/Blogger Account system, which wasn't fun at all, so I thought this might be easier.

Any help with this would make many happy users ;)
Cheers!
koz

ps: is this searchable? I cant see a search field to look for previous posts on this subject. thx. *rubs eyes*
linkReply

Comments:
[User Picture]From: int
2007-03-08 06:58 am (UTC)
I am honestly wondering why the hell you would use the Blogger API 1.0 to post to LJ, as it's old, insecure, and has craptacular experimental support within LJ that hasn't been updated since ever. Surely it's be easier to just use LJ's API (or re-use your GData stuff and post to the Atom endpoint)?

Anyway, Blogger 1.0 doesn't use structs. There's no title field. Where'd you get structs from anyway? Even the examples on 6A don't use structs. You have 5 strings (appkey, blog ID, username, password, content) and a boolean (publish). That's it. For more info you should be looking here instead of 6A.

(apologies for the bluntness, I haven't slept for a very long time)
(Reply) (Thread)
[User Picture]From: kosso
2007-03-08 01:14 pm (UTC)
Hi,
Thanks for that - and dont worry about the sleep - I know exactly how you feel! ;)

I did some tests with Atom too, but could not get that working.

Eventually I tried the 'flat' interface and used that.

The reason I wanted to use the blogger methods, is they are there and *should* work in the same way my other blogging tools work.

Also, the other systems I support use it (along with MetaWeblog) and it would have made my code easier.

Still, I'm very disappointed with the level of docs on SixApart's site. Pretty. But poooor! Lots of broken links too.

I see what you mean about the blogger - no struct - I was taking it for granted after seeing it on the metaWeblog.newPost http://www.sixapart.com/developers/xmlrpc/metaweblog_api/metaweblognewpost.html

which, I could not get to work either - and for the same reasons

thanks

Is this 'flat' method going to stick around? It looks 'old' - maybe because it doesn't have a fancy name like 'rest' or 'json'?


(Reply) (Parent) (Thread)
[User Picture]From: int
2007-03-08 06:36 pm (UTC)
The flat/XMLRPC methods will be around forever. Nearly every LJ client uses one of the two, and they still get features added to them now and again.
(Reply) (Parent) (Thread)