BUT in my quest to create the world's first fully web-based msn client, I've hit a huge pitfall. PHP can NOT multitask.
Here's the problem. If you've studied the msn protocol you'll see that in a switchboard session (conversation), the user first connects to the specified switchboard session (I'm using a separate php file - conversation.php) and then starts receiving packets, mainly about the user in the conversation, stuff like that. After the header stuff is done with, you start receiving far less data: all you get is "User is typing", "User sent this message: foobar", and "User has left conversation". My problem?
Code: Select all
while (!feof($fp)){
//get data from $fp
//extract their message and parse the data
}I couldn't get a textbox to submit to the running php script, so I was going to submit every message from the textbox into a mysql database, and then the "conversation" php file, in that while() loop, would check for new messages every 2 or 3 seconds. Sounds moderately easy at first, but it turns out it's impossible. The while() loop is *only* executed when I get new data from the socket.
The more clever amongst you may have seen 'ticks', a so-called novel approach to PHP multitasking, using code like this:
Code: Select all
<?
function foo(){
echo "bar";
}
register_tick_function("foo");
declare (ticks=1) 1;
?>I'm not sure if anybody is still reading this, and if so, I'm not sure you understand my problem, but if you do, AND you have ANYTHING at all to say (hint, idea, sympathy) PLEASE say it, I've put too much time into this thing to be screwed over at this point.
By the way, the working bot is online at http://www.qartis.com/bawt/contactlist.php , and his msn handle is "qartisbottery@hotmail.com".