Re: Testing smtp server

From: Date: Fri, 13 Dec 2002 20:41:56 +0000
Subject: Re: Testing smtp server
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128212@lists.php.net to get a copy of this message
On Friday 13 December 2002 21:30, Max Clark wrote: > I found the socket_create function that is listed as experimental and > requires a re-compile of php. Is there a built in way to perform this kind > of test? Based upon the second example on http://www.php.net/manual/en/ref.sockets.php : echo "<h2>TCP/IP Connection</h2>\n"; /* Get the service for TCP-Port 25. */ $service_port = getservbyport (25, 'tcp'); /* Get the IP address for the target host. */ $address = gethostbyname ('www.example.com'); /* Create a TCP/IP socket. */ $socket = socket_create (AF_INET, SOCK_STREAM, 0); if ($socket < 0) { echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n"; } else { echo "OK.\n"; } echo "Attempting to connect to '$address' on port '$service_port'..."; $result = socket_connect ($socket, $address, $service_port); if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n"; } else { echo "OK.\n"; } johannes

« previous php.general (#128212) next »