PHP Classes

File: socket.example.php

Recommend this page to a friend!
  Classes of Tom Reitsma   Socket handler   socket.example.php   Download  
File: socket.example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Socket handler
Generic TCP/IP client using sockets
Author: By
Last change:
Date: 18 years ago
Size: 661 bytes


Class file image Download

 * This is an example of how to connect to your local email server.
 * The variables set in the class should be adjusted to your own environment


$socket = Socket::singleton();

// S: +OK Hello there.

$socket->sendCmd("USER"); // (email login)
echo $socket->getResponse(); // S: +OK Password required.

$socket->sendCmd("PASS superSecretPassWoRd"); // (email password)
echo $socket->getResponse(); // S: +OK logged in.

$socket->getResponse(); // S: +OK 0 0

$socket->getResponse(); // S: +OK Bye-bye.