Jump to content


Photo

Telnet in php


  • Please log in to reply
3 replies to this topic

#1 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 19 July 2006 - 09:32 AM

Hi!

I want to create a telnet function with fsockopen.

could someone get me a hint how to do it!?

Best regards!

//Johan




#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 19 July 2006 - 02:07 PM

What do you want this function to do?

#3 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 19 July 2006 - 08:16 PM

Hi!

I want to se how many mails I've got on my mail-server.

I come up wih the code below but it dosen't work!

<?php
	function telnet_check_status($server, $port, $user, $pass)
	{
		$fp = fsockopen($server, $port, $errno, $errstr, 10);

		if(!$fp) {
			echo "Error: $errstr ($errno)<br />";
		}
		else
		{
			$command = "USER ".$user."\r\n";
			fwrite($fp, $command);
			$command = "PASS ".$pass."\r\n";
			fwrite($fp, $command);
			$command = "QUIT\r\n";
			fwrite($fp, $command);

			while(!feof($fp)) {
				$result .= fgets($fp, 128);
			}

			fclose($fp);
		}

		echo $result;
	}
?>

I get the folowing message:

+OK POP3 server ready (7.1.026.6) <7BDB52E280D9D910ED3F7A00A4BFD90EE706287D@pne-msproxy2-sn2.hy.skanova.net> +OK Password required -ERR [SYS/PERM] mailbox locked by a POP3 session


Any ideas?


#4 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 20 July 2006 - 08:15 AM

No one?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users