#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Hi
    Is it possible to create a chat program by using PHP. Or is it only possible by JAVA?
    Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    15
    it won't be possible to create a real-time chat application w/ php. since php just helps create pages, the best you could do is create pages based on some data, then keep refreshing the page as more data is added/changed in the data source.

    a real cheesy chat application could be built using php and a database, but users would have to continually hit refresh on a page (or the page could automagically refresh at regular intervals) to see new comments, much like this web forum.

    ------------------
    ~Chris
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,643
    Rep Power
    4492
    Sure it's possible, but i'd be like chatting on a Devshed forum. You'd have to submit a page for everything you wanted to say. Nothing would be real time...

    Stick with Java...

    ---John Holmes...
  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    You guys sound like the guy who proved airplanes can't fly. (Sorry, couldn't resist )

    It's been done, and nicely too. Your technical analysis is mostly correct, but with good use of Javascript, the client interface does not have to be clumsy or cheesy at all. One of the neat things a web-based chat is that users can do more than just straight text; They can use rich content, such as images, hyperlinks, HTML markup, etc...:
    http://www.phpwizard.net/projects/phpChat/
    http://www.hotscripts.com/Detailed/4003.html

    Of course it's not realtime, but neither is IRC, strictly speaking; messages don't display character-by-character as they are being typed. (That would be irritating)
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    15
    I've used phpChat ... It's the hackjob I was referring to when I mentioned creating an app with php and a database. It's a nice piece of work, but it's as far from a chat application as this BB is (and more of a server security hazard!!). Forcing a page to refresh so many times makes a cheesy chat application. It's incredible how much HTTP traffic it generates with a couple users on the same network segment.

    ------------------
    ~Chris
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 1999
    Location
    Denmark
    Posts
    83
    Rep Power
    16
    if you were creating this chat for IE only you could use Iframes, and only reload that frame...
    but this only works with IE..

    ------------------
    regds..
    -ulrik-
  12. #7
  13. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    I agree, that there are inherent problems with using http to run a chat type application, but let's face it: we're going to see more and more of this, so we may as well use our heads to come up with the best system.

    There are some good ways to minimize http usage. There is definitely no need to reload the main output page, just a minimal document that reads javascript variables with the text of the chat, and then writes that into the main output page.

    (Entering compromise mode) IMHO, though, the best way would be a judicious combination of Java and Javascript. Use DHTML/Javascript to build the GUI, use Java to handle only the data. It seems to me that GUIs using Java are always slow to load and temperamental, but using Java for an IRC connection makes sense.

    The book "Javascript Objects" by Wrox Press has some great examples of this kind of combined approach.

Similar Threads

  1. Executing a program as ROOT with php.
    By shadovv in forum PHP Development
    Replies: 6
    Last Post: April 12th, 2004, 07:44 PM
  2. Need help launching a program through php
    By musa1982 in forum PHP Development
    Replies: 5
    Last Post: February 17th, 2004, 03:50 AM
  3. execute C program from PHP
    By opteron in forum PHP Development
    Replies: 1
    Last Post: February 11th, 2004, 10:10 AM
  4. Looking for specific php program?
    By flamesrock in forum PHP Development
    Replies: 1
    Last Post: January 31st, 2004, 10:43 PM
  5. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM

IMN logo majestic logo threadwatch logo seochat tools logo