PHP头条
热点:

用php得到163的邮件信息


<?
$host=pop.163.com;
$port=110;
$user=******;
$password=******;

if(!($sock=fsockopen(gethostbyname($host),$port,$errno,$errstr)))
        exit($errno.: .$errstr);
set_socket_blocking($sock,true);

$msg=fgets($sock);
echo $msg;

$command="user ".$user." ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="pass ".$password." ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="stat ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="list ";
fwrite($sock,$command);
while(true)
{
        $msg=fgets($sock);       
        echo $msg;
        if(preg_match(/^./,$msg))
                break;
}

$command="retr 1 ";
fwrite($sock,$command);
while(true)
{
        $msg=fgets($sock);
        echo $msg;
        if(preg_match(/^.( )$/,$msg))
                break;
}

$command="quit ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;
?>

www.phpzy.comtrue/phprm/29563.htmlTechArticle用php得到163的邮件信息 ? $host=pop.163.com; $port=110; $user=******; $password=******; if(!($sock=fsockopen(gethostbyname($host),$port,$errno,$errstr))) exit($errno.: .$errstr); set_socket_blocking($sock,true); $msg=fgets($sock); ec...

相关文章

    暂无相关文章

PHP之友评论

今天推荐