Checking is STARTTLS is available using php

Hello

I would check if a remote server on port 25 is accepting STARTTLS for email using php , how can I do it ?

(I other words I should do this

telnet domain.com 25

Trying domain.com
Connected to domain.com.
Escape character is ‘^]’.
EHLO t220-hostname.domain.com ESMTP Exim 4.69 #1 Mon, 06 Feb 2012 08:26:08 -0500
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
EHLO aldsds.net
250-hostname.domain.com Hello localhost [27.12.12.222]
250-SIZE 52428800
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP

via php , is it possible ? )

Thank you

Sure, take a look at the socket_* family of functions.

thank you , the examples does not seem to help me a lot http://www.php.net/manual/en/sockets.examples.php , however I will see thank you.