I have some borrowed/modified socket+fgets code that stopped working sometime over the break(although that may be irrelevant)...

I\'m tearing my hair out, so help is appreciated.

This script does not exit, so I know that the socket is fine. But regardless of where I place fgets, $data is always empty!

if (!$socket = fsockopen($pop_server, 110, $errno, $errstr))
{
echo \"Connection to mail server dead.\";
exit;
}

fputs($socket, \"USER $pop_user\r\n\");
fputs($socket, \"PASS $pop_pass\r\n\");
fputs($socket, \"STAT\r\n\");
fputs($socket, \"QUIT \r\n\");

while(!feof($socket))
{
$data .= fgets($socket,1024);
}
echo nl2br($data);
fclose ($socket);

    Can you connect to the pop server outside of the program?

    btw, do you have any relatives named "Sig"? grin

    -Ben

      Yes I can get to the pop server no problem... first thing I checked. If I couldn't, surely the function would exit?

        Only suggestion I have is to do a var_dump of fgets($socket,1024) in the while statement. If that turns up null, go back and do a var dump of $socket ... find out where you are losing it.

        Sorry I can't be of more assistance.

          Write a Reply...