php3-list | 199807

[PHP3] some more socket trouble From: Adam Roderick (adam <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:

$fp = fsockopen($server, $port);
fputs($fp, "user username");
fputs($fp, "pass password");
fputs($fp, "list");
fputs($fp, "quit");
###Everything seems to work just fine up to here

echo fpassthru($fp);
/* When I include this line, the program acts like it is stuck in a while
loop, it's hung up on something and is continually reading. */

echo fgets($fp, 200);
/* When I include this line --but take out the line containing
fpassthru()--, the buffer, or first line of the socket "file" is
displayed:
--------
+OK mail.server.com POP3 3.3(20) w/IMAP2 client (Comments to
MRC <email protected>) at Tue, 14 Jul 1998
11:47:06 -0500 (CDT)
--------
Ok, good, that's what it should do. */
fclose($fp)

But I can't retrieve any other information, such as the confirmation or
rejection of the user and the password, nor can I retrieve the list of
messages. I've tried different things, such as changing the position of
and taking out the "fputs($fp, "quit");" command and the "fclose($fp);"
command (no difference), I've tried this:

while(!feof($fp)) {
        echo fgets($fp,128);
}

This is straight out of the documentation under "fsockopen".
It seems to act just like fpassthru(), just getting hung up and
continually reading the file. I believe both of these get hung up because
there is no true end of file in the socket connection. If anyone can help
me, please respond, and thanks in advance.

Adam Roderick
adam <email protected>
Hypernet Communications, Inc.

--
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