Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199807

Re: [PHP3] some more socket trouble From: Rasmus Lerdorf (rasmus <email protected>)
Date: 07/14/98

> Well, you're probably getting tired of hearing from me, but I still cannot
> retrieve any information beyond the first line of the socket connection.
> Here's a copy of my code:

Ok, I just wrote myself a little test version of what you are trying to
do. It worked fine. I don't think you are doing your fputs() and your
fgets() calls at the right time. Or maybe you are forgetting to send a
carriage return in your fputs().

Here is the little script which works fine for me:

<?
        $host = "XXX";
        $id = "XXX";
        $password = "XXX";

        $fp=fsockopen($host,110);
        $cmd="user";
        while(!feof($fp)) {
                switch($cmd) {
                case "user":
                        fputs($fp,"user $id\n");
                        $cmd = "pass";
                        break;
                case "pass":
                        fputs($fp,"pass $password\n");
                        $cmd = "list";
                        break;
                case "list":
                        fputs($fp,"list\n");
                        $cmd = "quit";
                        $break;
                case "quit":
                        fputs($fp,"quit\n");
                        $break;
                }
                $reply = fgets($fp,80);
                echo $reply;
        }
        fclose($fp);
?>

By the way, you would be much better off using the imap.so module for
this. It supports talking to POP servers.

-Rasmus

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive: http://www.tryc.on.ca/php3.html