• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

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?
0
COwebmaster
Asked:
COwebmaster
  • 3
  • 3
4 Solutions
 
hieloCommented:
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.
0
 
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
0
 
hieloCommented:
>>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?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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.
0
 
hieloCommented:
>> 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:
http://harrybailey.com/2009/02/send-or-pipe-an-email-to-a-php-script/

I don't know how to do that using postfix, but perhaps this will help:
http://adkap.com/autoresponder.html
0
 
crazedsanityCommented:
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:
$("#chatBox").html();

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.
0
 
COwebmasterAuthor Commented:
Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now