ajax, php, mysql, chat box

I'm running a wordpress site on my server which runs php and railo (open source coldfusion) and on the website I have a live chat box.  There are no form fields within the chat box.  Using Ajax and php, is it possible to dump the entire chat session into a mysql db table?
Who is Participating?
does your chat "module" have an api where you can "react" to changes on the interface? (If you don't know/understand what I'm asking you, then post a link to a sample/test page OR post your chat script)

If the answer is yes, then send an ajax request to your server on every change, inserting a new record the first time and updating the record thereafter.
COwebmasterAuthor Commented:
this is the script the company gave me which is above the end body tag on each page...

<script src='http://widget.rlcdn.net/widget/rl_chatwidget.js'></script><script>var id ='USA2146036'; var rl_adid='103533'; var rl_key = '203637'; rl_chatinit(id, rl_adid, rl_key) ;</script>

I was told that there is no api
>>I was told that there is no api
Do they email you a "transcript" of the chat after the chat is done at least? IF yes, do you have Linux/Unix webserver?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

COwebmasterAuthor Commented:
yes, on both.  They will email me just the contact info from that conversation so I can then pass it along to a vender.  I use fedora and am using postfix on the server.  Once the email comes in, I have to then send the emails in a next-in-line rotation.  not sure how to do that using postfix.  i have php and railo which is open source coldfusion on the server.
>> They will email me just the contact info
Well, if they don't send you all the chat, then I guess that's the end of it. I thought you wanted everything. From the browser, you will not be able to do this because ultimately the script redirects to an external domain and you don't have access to retrieve data from a page that runs on a different domain. Your only hope would have been if they provide an api.

At any rate, I was thinking that you could perhaps PIPE the email to a php script. In the php script you would take all that info and save it onto a DB.  I've done this in the past from CPanel:

I don't know how to do that using postfix, but perhaps this will help:
it is definitely possible to get the entire contents of the chat, but it would require some javascript-fu.  Basically, you would have to figure out how to reference the chat box in the DOM (Document Object Model)... this is easiest if you can use jQuery and the chat is enclosed in something that has a specific class or (preferably) an ID.

If the chat box has an ID, you can get the contents in jQuery really easily.  In the instance where the ID of the chat box is "chatBox", you can get the contents with:

Open in new window

.  That can be stored on the server using some fairly simple AJAX.

Figuring out how to reference that box is the most important part.  I would suggest using Firefox with the Web Developer toolbar; it has options to display a lot of hidden information on the page without having to view source (dynamically loaded stuff, like what you're working with, usually doesn't show when viewing source).  Adding Firebug with FireQuery will allow you to use the console & force loading of jQuery onto the page so you can figure out how to get the info you need.
COwebmasterAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.