I'm building a webmail-client-like application, and I'm having issues connecting to POP3 through our beloved corp proxy. 

Due to client requirements, I'm obligated to use sockets to talk with their POP3 server (they actively specified this is mandatory and they also explained they have a proxy between the app server and the POP) so besides enabling me to work this is kind of the only option I have.

Does anyone know how to do this? 

UPDATED TO ADD:

Here's my socket handler:

```
<?php
class Socket {
  protected $handle = null;
  protected static $status = null;
  public function __construct($server, $port){
    if(!$this->connect($server, $port)){
      throw new UnexpectedValueException("Server $server in port $port unreachable.");
    }
  }
  public static function getStatus(){
    return self::$status;
  }  
  public function write($string){
    fputs($this->handle, $string);
    return $this;
  }
  public function read($lines = 1){
    $lines = abs((int)$lines);//people can be morons
    for($i = 0; $i < $lines; $i++){
      $response []= $this->getLine();
    }
    if($lines==1){
      $response = $response[0];
    }
    return $response;
  }
  public function connect($server, $port){
    $errNo = 0;
    $handle = fsockopen($server, $port);
    if(!$handle){
      return false;
    }
    $this->handle = $handle;
    return $this;
  }
  public function disconnect(){
    if(gettype($this->handle)=='resource'){
      fclose($this->handle);
    }
  }
  public function __destruct(){
    $this->disconnect();
  }
  protected function getLine(){
    return fgets($this->handle);
  }
}

```

I'm using it like so: 

```
$plug = new Socket('mx.mailserver.com',110);
$plug->write("USER $username\n")->read();
$could = $plug->write("PASS $password\n")->read();
if(strpos($could,'+OK')!==false){
  $mails = $plug->write("STAT\n");
}

```

And right now our proxy is not letting me out; situation I would like to know how to revert.