?

Log in

No account? Create an account
Hi! This is my first time posting here. I am in a band.. and we… - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

[Jan. 15th, 2003|10:27 pm]
LiveJournal Client Discussions
lj_clients
[idiequietly]
Hi! This is my first time posting here.

I am in a band.. and we started a livejournal community where we can post things we are doing band related..

Well, we are starting to build our website now.. and I wanted to embed our band journal into the site.. I didnt like any of the options that lj journal gives you for embedding.. so I decied that I would need to some how get whatever we post to our community onto our website in a more raw format.. so we can format it diferently. Since our site is done in php, so.. goes the coding of the client.

Here is my first accomplishment.. basically php connects to the server and downloads the first entry.. nothing really intresting to you guys i am sure.. but I am pretty happy with what i have done in the last half hour.. =]!

here..
1. http://illthoughts.pureprotest.com/test.php <- Test php script
2. pdm <- band community

The long term plan for this will be..

Have php download and track our livejournal community.. store the posts in a mysql database and display them from the database.. if lj is being bogged down by traffic.

Currently, I am using the get/post method to retrieve the data.. but i plan on using xml-rpc as soon as i can get the webadmin to recompile php with that support. I am sure.. someone has already done this, so if you had any tips or problems that you are sure I am going to run into feel free to inform me! anyways.. take care &&dan



I've got a question.. what are some ways you guys parse through the variables?

I am using Regular Expressions in PHP..
ereg("events_1_event\n(.*)\nevents_1_eventtime", $j_data, $j_reg);

but there has to be a more simple expression to extract the events_event? .. I am not too great with regular expressions =]

.. for some reason.. this doesnt work
ereg("events_1_event\n(.*)\n", $j_data, $j_reg); <-??
linkReply

Comments:
[User Picture]From: evilhat
2003-01-15 10:58 pm (UTC)
Well, for client operations in flat mode, there's really not any parsing that needs to be done -- you just read the text and stick the values into appropriately-named variables. (If the language you're writing in supports a hash structure, that's the most convenient.)

For XML-RPC mode, just parse the XML using whatever lightweight XML parsing library is available for the language that you're using. (At this point, I'd wager that such libraries exist for pretty much any language a LiveJournal client author might want to use.)

I currently use flat mode only in my client; I haven't yet seen a compelling reason why I should go to the XML-RPC interface instead.

As a side note, it sounds like you're reinventing the wheel. If you want more customization than straightforward LJ embedding can give you, why not just set up your own private livejournal-framework server, and customize the LJ source code?

(What are you trying to do that embedding doesn't get you?)
(Reply) (Thread)
From: idiequietly
2003-01-15 11:20 pm (UTC)
We want to stay with livejournal.com.. larger community. By keeping a local copy of our journal on our website.. we can mix News posts and Journal posts.. with the added feature of being able to negate either or.

Journal Updates.. being personal but band related.
News Updates.. being show dates and studio/release info.

and.. besides it gives me something to do.. while i am working *cough*

hehe, i saw your other post thank you.. &&dan
(Reply) (Parent) (Thread)
[User Picture]From: evilhat
2003-01-15 11:01 pm (UTC)
Whoops, I replied to this before you edited your post to clarify your question.

Do a simple loop: read line A, read line B (the line after line A), assign hash{"line A"} = line B.

Then do all of your future operations by just checking hash{"var"}.
(Reply) (Thread)
[User Picture]From: benzado
2003-01-16 09:59 am (UTC)
You might want to consider using the syncitems mode to copy items from LJ into your database. syncitems will give you itemIDs, and then use getevents to get the item text. Put the text into your database. You could run this script every night or every few hours. Then your own display stuff only needs to display items from your database.

When you say the second RE doesn't work, does it pick up nothing or too much? If it picks up too much, then your RE is being greedy. In Perl you would fix this by writing: "events_1_event\n(.*)?\n" as your pattern (see the added question mark?). I'm not sure what you need to do for ereg in PHP. You could also use this "events_1_event\n([^\n]*)\n" as a pattern. [^\n] means everything that is not a newline. You don't want to put anything after the last newline in your pattern because the order of the arguments is not defined.
(Reply) (Thread)
From: idiequietly
2003-01-16 10:14 am (UTC)

Re:

yah, it was being greedy

Now I am doing it a diferent way.. I just feed everything into a array.

$j_data[NUM]["event_NUM_EVENT"]=data

works alot better.. and more organized.

now i just use a regular expression to extract the numbers from the events as i populate the array. which.. sorts the array as well =]!

I am reading more on regular expressions.. i find them very useful now that i am starting to understand them =]!
(Reply) (Parent) (Thread)