I just got added to a new project and as I'm a novice in web development, I need a little bit of help. I'm working on a project called VBS 2 (which is a FPS game) mingle with a trust system. Basically while you play, messages will be displayed (time, information, source and level of trust) and players will tell whether they trust this information or source or not.
My job is to display the messages so I guess, I have to implement a port listener that for each new incoming message on the specific port, will add the content of the new message to the current displayed list. I have absolutely no clues if it's feasible in PHP, so please let me know how you would implement that idea.
Thanks a lot,
05-30-2012, 03:22 PM
It's not the best language for that, you would be better off with something like Python for such a task.
If you must go down that route... remember to handle output buffering... remember to flush it each time you want to send data to the browser... and here is the huge list of socket functions you may need: http://php.net/manual/en/book.sockets.php
I've recently built an instant messenger using PHP & MySQL as the backend... and i had to do it using AJAX using the Prototype library. This works well because sockets tend to be a pain the ar*e to program and to do it in PHP is like ice skating up hill!
P.S. I also did a IRC bot a while back using sockets - trust me, it's not nice programming!
05-30-2012, 04:01 PM
Yeah, Python would definitely work better. Ruby (not Ruby on Rails) could do the trick as well. I made an interactive SSH client using Ruby once. It was pretty easy. Just had to run it as a service.
06-04-2012, 06:57 PM
Thanks for your useful responses. Unfortunately, I never did either python or Ruby but I found out a script using sockets in Php and modified it in order to display the informations needed.