Re: PHP to read and write on a MUSH/MUX
| From: | Luke | Date: | Fri, 05 Dec 2003 00:29:44 +0000 |
| Subject: | Re: PHP to read and write on a MUSH/MUX | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171927@lists.php.net to get a copy of this message | ||
I havent done anything like that, but do you have to send a CR or LF after
the connect command (the same as pressing enter?) as i said, not sure how
you do it, but that could be a prob? try changing to
fputs($thresh, "connect USERNAME PASSWORD\n\r");
or
fputs($thresh, "connect USERNAME PASSWORD\n");
or something similar
like to know how it go's
--
Luke
"Angel Of Death" <azrael@azrael-uk.f2s.com> wrote in message
news:3FCFB434.5020700@azrael-uk.f2s.com...
>
> I'm fairly new to PHP and am trying to make a script that connects to a
> MUSH, logs in, sends some commands, reads some data back, and then exits.
>
> I have the following code:
> ########## start code ############
>
> $thresh = fsockopen($hostname, $port, &$errno, &$errstr, $timeout);
>
> if(!$thresh)
> {
> echo "Connection Failed<br>\n";
> echo "$errstr ($errno)<br>\n";
> exit();
> }
> else
> {
> echo "Connected<br>\n";
> $last = 0;
> fputs($thresh, "connect USERNAME PASSWORD");
> while($tmp = fgets($thresh, 1024))
> {
> echo $tmp . "<br>";
> }
> echo "Closing..";
>
>
> }
> fclose($thresh);
> ########### end code ##########
>
> It is connecting to the game, I can see that form inside the game.
> However it is not logging in (connect USERENAME PASSWORD).
> Also, I am not sure how to change the while loop, because I game never
> breaks contact, I believe there is always something coming in.
> I had tried feof($thresh) first of all, but that gave the same result -
> i.e. hanging as if waiting for more input without moving on.
>
> Does anyone have any suggestions for me. Has anyone done this sort of
> script before, can they show me theirs, point me to some specific help?
>
> many thanks
>
>
>
>
>
> --
> Azrael
>
> ("\''/").___..--'''"-._
>
0_ O ) -. ( ).-.__.)
> (_Y_.)' ._ ) ._ . ``-..-'
> _..`--'_..-_/ /--'_.' .'
> ((i).-'' ((i).' (((.-'
>
> Of all God's creatures there is only one that cannot be made the slave
> of the lash. That one is the cat. If man could be crossed with a cat it
> would improve man, but it would deteriorate the cat.
>
> ICQ#52944566
> Registered Linux User: 269002