tonytraductor (tonytraductor) wrote in lj_dev,
tonytraductor
tonytraductor
lj_dev

pebcak

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 www.livejournal.com 80]
puts $chan "POST /interface/flat HTTP/1.1\n
Host: www.livejournal.com\n
Content-type: application/x-www-form-urlencoded\n
Content-length: 105\n
\n
mode=postevent&user=tonytraductor&password=******&subject=testing+testing+testing&event=this+is+a+test+post"

close $chan

exit
}

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).
Tags: client, client: posting, code: tcl/tk
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments