Log in

No account? Create an account
SMS to lj - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

SMS to lj [Nov. 16th, 2002|08:48 am]
LiveJournal Client Discussions


I had an idea yesterday for a program that would take a SMS message and turn it into a live journal entry.

What I am planning is on having a website where people register their mobile number and a livejournal username and password associated with it. Then they can post simply by sending a SMS in the format of "livejournal blah blah blah". The message would be passed along to a PHP script would then process the entry and contact the live journal server to post.

The SMS side of things is simple to do, thanks to a SMS gateway provided by my employer. But I've never used PHP before (started learning it last night, doesn't seem too difficult) and I've never written anything to communicate via HTTP before.

If anyone could point me in the direction of some sample PHP code, preferably a livejournal client in PHP, that would great. I also need information on the hashing scheme used by livejournal so I am not storing the passwords in plain text.

Also comments and any immediate problems you see with this scheme would be very appreciated.


[User Picture]From: kid_icarus75
2002-11-15 04:27 pm (UTC)
i've developed a php journal interface. it's pretty much been used only to retrieve entries, but its all class based and should be easy to build upon for you desires. the only catch: it's all GPL so you have to open your source up and GPL it yourself.
(Reply) (Thread)
[User Picture]From: adrieljohnson
2002-11-15 05:43 pm (UTC)
This is private code from my client MultiJournal.

$fp = fsockopen ("$myrow[2]", 80, &$errnr, &$errstr) or die("$errno: $errstr");
$data1 = "mode=login&user=$username&password=$password&clientversion=Web-MultiJournal/1.0.0";
fputs($fp, "POST /interface/flat HTTP/1.0\r\n");
fputs($fp, "Host: www.livejournal.com\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data1). "\r\n\r\n");
fputs($fp, "$data1\r\n\r\n");
$ok = 0;
while (!feof($fp)){
$res = fgets ($fp, 10240);
if (strstr ($res, "OK")) {
$ok = $ok + 1;

The code will login to the server. And it will parse for OK and it will get 2 ok's so it will bumb the ok from 0 to 2 if they have sucessfully logged in. You can use the same code to post entries just changing the $data1 code.
(Reply) (Thread)
[User Picture]From: adrieljohnson
2002-11-15 05:45 pm (UTC)
to generate a md5 password use

$password = md5($password);

then send

LiveJournal communicates with plain text password and md5 password. but you must only use one either password or hpassword.
(Reply) (Parent) (Thread)
[User Picture]From: adrieljohnson
2002-11-16 07:50 am (UTC)
You might want to visit http://www.livejournal.com/doc/server/ljp.csp.protocol.html too. It describes the LiveJournal Client-Server protocol.
(Reply) (Parent) (Thread)
[User Picture]From: adrieljohnson
2002-11-15 05:46 pm (UTC)
replace $myrow[2] with www.livejournal.com sorry the code is parsed from a database.
(Reply) (Parent) (Thread)
[User Picture]From: inpotentia
2002-11-16 09:33 pm (UTC)
Thank you so much. This code will make it a lot quicker for me to develop the application now I have something to work off.
(Reply) (Parent) (Thread)