WEB开发网      濠靛倻鏅悵顖涚附閽樺鐎诲ù婊庡亾缁辨帗鎷呴悩鍨暠濞戞挴鍋撳ù鐘烘閸ㄥ孩绂嶉锝喰﹂柟瀛樺灣濠婃垿鎯冮崟顏嗩伇濞寸姾妫勬慨鈺呭礉濞戝磭骞㈤悹鍥у槻閸ㄥ孩绂嶉敓锟� ---闁挎洩鎷�
开发学院WEB开发PHP 用php得到163的邮件信息 阅读

用php得到163的邮件信息

 2008-12-16 16:21:45 来源:WEB开发网 闁靛棴鎷�闁告垵绻愰惃顒傗偓娑欍仦缂嶏拷濠⒀呭仜閵囧洨鈧稒銇炵紞锟�闁靛棴鎷�  闁稿繗娅曢弫鐐次涘▎鎰泚闁告娲ㄥ▓鎴濐嚗椤旂厧瑙�
核心提示:<?$host='pop.163.com';$port=110;$user='**';$passWord='**';if(!($sock=fsockopen(gethostbyname($host),$port,$errno,$errstr))) exit($er

<?
$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."\r\n";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

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

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

$command="list\r\n";
fwrite($sock,$command);
while(true)
{
     $msg=fgets($sock);    
     echo $msg;
     if(PReg_match('/^\./',$msg))
         break;
}

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

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

Tags:php 得到 邮件

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接