Jump to content

Archived

This topic is now archived and is closed to further replies.

Re-JeeP

Telnet in php

Recommended Posts

Hi!

I want to create a telnet function with fsockopen.

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

Best regards!

//Johan


Share this post


Link to post
Share on other sites
What do you want this function to do?

Share this post


Link to post
Share on other sites
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!

[code]<?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;
}
?>[/code]

I get the folowing message:
[quote="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[/quote]

Any ideas?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.