?

Log in

No account? Create an account
A post in my journal with Perl. - LiveJournal Client Discussions — LiveJournal [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

A post in my journal with Perl. [Oct. 17th, 2004|09:24 pm]
LiveJournal Client Discussions

lj_clients

[djdavejumpers]
Hi,
I'm trying to write something simple in Perl, to post a private message in my journal.
Is not working for me, though.

This is what I have done so far:

#!/usr/bin/perl -w
use IO::Socket::INET;
$MySocket=new IO::Socket::INET->new(
PeerPort=>80,
Proto=>'tcp',
PeerAddr=>'livejournal.com');

$msg="POST /interface/flat HTTP/1.0
Host: www.livejournal.com
Content-type: application/x-www-form-urlencoded
mode=postevent&user=LJUSER&password=LJPASSWORD&event=yomama+is+phat&security=private";
$MySocket->send($msg);
exit;


I tried just telnet www.livejournal.com and pasting $msg, and the connection gets' closed.
Am I missing something?
Also, how would you implement this, so that the password is not sent in clear text?.

I read http://www.livejournal.com/doc/server/ljp.csp.flat.postevent.html but says that password is Deprecated?
I'm confused.

Perhaps one of you can give me an example on what to put on that line that starts with "mode"

Thanks
-Dave-
linkReply

Comments:
[User Picture]From: lordindra
2004-10-18 11:35 am (UTC)
I've got a basically functional LJ client in Perl/Tk, development has stopped because I just couldn't deal with the broken Tk text widget.

It supports private/friends/friend group/public posting, using the XML-RPC interface. So if you are willing to use that interface, you can lift the code out you need. It isn't terribly well commented I'm afraid, and I'm sure you know how evil 200 or so lines of poorly commented perl can look.

It also supports moods, can't remember if I ever got around to user pictures or current music.
(Reply) (Thread)
[User Picture]From: djdavejumpers
2004-10-18 12:45 pm (UTC)
where can I find it?
(Reply) (Parent) (Thread)