Login   Register  
PHP Classes
elePHPant
Icontem

File: socket.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 8 years ago
Size: 661 bytes
 

Contents

Class file image Download
<pre><?php

/**
 * 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
 */

include("socket.class.php");

$socket Socket::singleton();

$socket->connect();
// S: +OK Hello there.

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

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

$socket->sendCmd("STAT");
echo 
$socket->getResponse(); // S: +OK 0 0

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

?></pre>