September 13th, 2008

Bernard Napping, wtwta - Bernard Napping
  • sloot

Trying to post via Atom

I got the following error when trying to post via atom

HTTP/1.0 400 Bad Request
<html><head><title>400 Bad Request</title></head><body>
<h1>Bad Request</h1><hr /><p>Could not parse the entry due to invalid markup.<br /><pre>Empty String at /home/lj/cgi-bin/XML/Atom/ line 40

This is what I tried to post:

<?xml version="1.0" encoding="utf-8"?>
<entry><title>testing!</title><content>my content is here</content></entry>

I can't find any documentation on what I should be putting in an entry


I would like to add lj posting capability to Tickle Text, a text editor I wrote in tcl/tk, but, being entirely new to trying to work with this particular kind of thing (communicating with a remote machine, but not using ftp or ssh) I'm a little lost.
Maybe someone here can straighten me out...or point me to resources that explain the matter a bit more clearly.
I'm using what I found here (Part III. Client/Server Protocol) and here (Tcl socket manual page).

This is the proc I've written, as a test, and it doesn't seem to be getting any response, or, effectively posting to my journal.
This is the most basic attempt just to understand how to use
a) socket
b) the protocol to communicate with the LJ server.

proc ljpost {} {
set chan [socket 80]
puts $chan "POST /interface/flat HTTP/1.1\n
Content-type: application/x-www-form-urlencoded\n
Content-length: 105\n

close $chan


I don't even understand, at this juncture, how to get/read a response from the server.
The only things I've written that have had to communicate with a remote machine have used ssh or ftp,
so, this is completely unfamiliar territory to me.
I don't know, here, if I am misunderstanding how to use tcl socket, or the protocol to communicate with the server.
I know I'm doing something wrong, because this fails to post to my journal (yes, I replace ****** with my actual password).