Log in

No account? Create an account
Protocol issue - LiveJournal Client Discussions — LiveJournal [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

Protocol issue [Jun. 20th, 2002|10:08 am]
LiveJournal Client Discussions


[mood |puzzled]

I have a simple LJ embedding in my website done with ColdFusion. About a month ago it stopped working and I just today got around to trying to fix it. (I make a living doing CF, I don't want to do it when I go home, that's why it took so long.) The error message being returned:

errmsg Client error: No mode specified. success FAIL

So I read some back posts and see that using HTTP GET seems to have been disallowed at some point in May or so, which is what I'd been using:

<CFHTTP URL="http://www.livejournal.com/interface/flat?mode=getevents&user=theprophecy&hpassword=[removed]&selecttype=lastn&howmany=9" method="GET" timeout="30">

So no big deal, I switched to POST:

<CFHTTP URL="http://www.livejournal.com/interface/flat" method="post" timeout="30">
<cfhttpparam type="URL" name="mode" value="getevents">
<cfhttpparam type="URL" name="user" value="theprophecy">
<cfhttpparam type="URL" name="hpassword" value="[removed]">
<cfhttpparam type="URL" name="selecttype" value="lastn">
<cfhttpparam type="URL" name="howmany" value="9">

...which to my surprise, returned the exact same error. I checked the protocol documentation again to see if I'd missed some earthmoving change, but as near as I could tell everything was kosher (tho obviously not). What am I missing?

[User Picture]From: erebrandir
2002-06-20 08:07 am (UTC)
Make sure you're using HTTP 1.1.

I've had a similar problem with clients that I've written with Perl libwww (LWP). It apparently stopped working about a month ago. I have an older version of the LWP modules on my Win32 system, which has no HTTP 1.1 support; but when I tested it on my Linux system, with a new version of the LWP modules thas supports HTTP 1.1, it started working again.

I don't recall which changes would've brought us to using strict HTTP 1.1, but that appears to be the case.
(Reply) (Thread)
[User Picture]From: xb95
2002-06-20 08:08 am (UTC)
Odd. Are you sure that the encoding is fine? I don't know CF, so I don't know if the type="URL" means "content-encoding: x-www-url-formencoded" or whatever it should be. Other than that, not sure what would be causing this. You may want to setup a test server somewhere and run that against it and make sure it's doing the post right. Shrug.
(Reply) (Thread)
[User Picture]From: theprophecy
2002-06-20 09:03 am (UTC)
The content-type is application/x-www-form-urlencoded, but... son of a #*@(%, we've got a winner. CF will only post in that content-type, but apparently LJ will no longer accept the variables as URL; they have to be formfields. This code works (so far ;) ). Just replaced "URL" with "FORMFIELD".

<CFHTTP URL="http://www.livejournal.com/interface/flat" method="post" timeout="30">
<cfhttpparam type="FORMFIELD" name="mode" value="getevents">
<cfhttpparam type="FORMFIELD" name="user" value="theprophecy">
<cfhttpparam type="FORMFIELD" name="hpassword" value="[removed]">
<cfhttpparam type="FORMFIELD" name="selecttype" value="lastn">
<cfhttpparam type="FORMFIELD" name="howmany" value="9">
(Reply) (Parent) (Thread)
[User Picture]From: xb95
2002-06-20 10:21 am (UTC)
Hehe, glad it works. :) Congrats!
(Reply) (Parent) (Thread)
[User Picture]From: inhumandecency
2002-06-20 09:00 am (UTC)
My experience with CF has indicated, terrifyingly, that it sometimes confuses GET with POST. Try using the POST command you are now with method="GET"
(Reply) (Thread)
[User Picture]From: theprophecy
2002-06-20 09:06 am (UTC)
LOL, CFHTTP definitely has its holes... it's a pity, such a numbingly simple yet powerful HTTP function, but they've screwed it up from the get-go, haven't they? GET/POST swaps, broken IIS5/Win2k compression, inability to send raw data (read: XML), etc.
(Reply) (Parent) (Thread)