How do I test an fsockopen pointer if the SERVER has disconnected prematurely? I'm using SMTP and the NOOP command really slows down my script. Example code below:
$p = fsockopen('mail.mysite.com','25');
fputs($fsockopen,"QUIT\r\n"😉;
fgets($fsockopen,1024);
if(is_resource($p)) echo "Still connected. :-("; else "Not connected - reconnect!";
Doesn't work. $p will always be defined and won't be destroyed.
Is there any other way?
Thank you for any insight you can provide.
DW