Current File : //etc/zpanel/panel/ajaxcall.php
<?php
$command="ViewMail ".$_POST['id'];
	/* Get the port for the WWW service. */
	$service_port = 4444 ;

	/* Get the IP address for the target host. */
	$address = gethostbyname('localhost');

	/* Create a TCP/IP socket. */
	$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
	if ($socket === false) {
	    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
	} 
$result = socket_connect($socket, $address, $service_port);
	if ($result === false) {
	    echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n";
	} 

	socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" =>1, "usec" =>0));

	$in="command " . $command ;

	$out = '';
	socket_write($socket, $in, strlen($in));
	$output = "" ;

	while(true)
	{
		sleep(10);
		$out = socket_read($socket, 2048);			
		$output .= $out ;
		echo $out ;
		if ($out)
		break ;
	}
	
	socket_close($socket);
?>