using curl and ical to keep track of buddy's online

Hello guys,
My friends and I are trying to see at what time most of us are
online together. We use to play and chat
together. I am trying to write a script that will run every hour
(scheduled by ical) and check a “user’s” last login and logout.

set remoteApp to ""
set URLEncodedVars to "id=111672"
do shell script "curl -d " & URLEncodedVars & space & remoteApp

I have gotten as far as submitting the users account id to the web
and getting the users data. What I want to do now is take the users
name and create a calender with his name, (or add to that calender).
I would like to create a new event in ical using the users name as
description, last login as start date & time, last logout as end
date & time. I surfed the bbs for hours trying to get tips, but even
though i got close, I need your help. And if your are reading this and
don’t know the whole solution, any advise will help alot, I don’t care
if this is a huge thread, and I hope jj doesn’t either. You rock jj!

one really important thing i didn’t mention.
If there isn’t a logout time then i need it to
end. If the data hasn’t changed for a user
and is already on ical, will it add the same event
again? or overwrite the last event?