PHP Chat

All about creating websites!
Post Reply
User avatar
Broken Angel
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 432
Joined: 05 Jul 2010, 04:58
13
Contact:

PHP Chat

Post by Broken Angel »

I a working at a firm, yes I have started on my first Job. They are not paying me any money right now... ](*,) waiting for the Seed Investment to happen.

What they want is this:

They have a website for buying and selling second hand goods. They are looking for a chat solution where the buyers can talk to sellers and decide on the price and other things.
I am clueless on how to get that happening.
This chat will happen on Web Browser as well as from the App that the buyers and sellers will be using.

*thumb* Any ideas where to look???

Also will Google Cloud Messaging work for this?
God Blessed Me With Forgiveness And I Forgive You With My Revenge...!



-Broken Angel

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: PHP Chat

Post by bad_brain »

hm, good full PHP chat applications are hard to find, they either cost money (no idea how good those are) or they simply suck. all the ones I have tried were pretty annoying because they either cause a high server load by constant database activity (the more users the worse) or they cause some kind of permanent site reload.

it's better to use PHP just for the display part, but running the actual chat on a different service....never have tried google messenger, but I'm pretty sure they offer some kind of API you can use to connect your PHP script to.
another idea, even if a little old school, is to use IRC, here on suck-o it's done that way (front page web IRC box on the right).: https://kiwiirc.com/" onclick="window.open(this.href);return false;
works really good and is easy to configure, feel free to create a channel on the suck-o IRC server for testing...;)
Image

User avatar
Broken Angel
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 432
Joined: 05 Jul 2010, 04:58
13
Contact:

Re: PHP Chat

Post by Broken Angel »

Second hand Goods selling website is type of chat that I was talking about...
God Blessed Me With Forgiveness And I Forgive You With My Revenge...!



-Broken Angel

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: PHP Chat

Post by bad_brain »

like ebay in a chat? :?
never heard of such a concept, are the already known sites? :-k
Image

User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1215
Joined: 20 Aug 2005, 16:00
18

Re: PHP Chat

Post by CommonStray »

PHP can't do this alone unless the user refreshes the page every time they want to see a new message, and every time you want to send a message.

You have to build an AJAX solution that requests (http GET) information from PHP periodically (at an interval and updates the chat box when new information is found), it would also send (http POST) new information to PHP to store without refreshing the page.

This type of functionality is typically achieved with JavaScript, and to make things easier can be done using a client-side JavaScript framework such as jQuery.

1. build a form
2. have javascript capture the submit event for the form, and send the data to the location of your PHP script that handles the incoming post data(validation etc...) and stores it in the database
3. javascript periodically makes a request to a PHP script that finds and returns newly stored data
4. javascript updates the chatbox/div/whatever with the new information.

Post Reply