Author Topic: Bit of PHP fun  (Read 1870 times)

Offline saquivor

  • BFF
  • ***
  • Posts: 110
    • View Profile
Bit of PHP fun
« on: May 13, 2007, 01:19:33 PM »
I was looking at coffee mud today and was impressed by how mud interacts with objects in real time. So decided to play with PHP sockets to see if I could do something silmilar :)

Well here is a rough early script that does show the potential of php! So phase 2 of my tool will use php. I am sure you can all see how this script could be extended to do some really fun stuff!

Current script assumes you have already created user and will log on and send a message on newbie channel if it exists.

Connection will time out after property shown in script and via php.ini default_socket_timeout = 60



Code: [Select]
="localhost" ;
$sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ;
if (!
is_resource($sk)) {
"connection fail: ".$errnum." ".$errstr) ;
} else {
fputs($sk"username\n") ;
fputs($sk"password\n") ;

fputs($sk"newbie I am a php bot test\n") ;
$dati="" ;
    while (!
feof($sk)) {
$dati.= fgets ($sk1024);
fclose($sk) ;
$dati) ;