Home  >  Article  >  Backend Development  >  Questions about fsockopen_PHP tutorial

Questions about fsockopen_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:51:38900browse




Questions about fsockopen

Today when I was using fsockopen to write and send an email, I found a strange problem
Here is the code:



$fp=@fsockopen("smtp.163.com","25",$errno,$errstr);

if($fp){

echo "ok";

fclose($fp);



}else{

echo "error:".$errstr;

}

echo "
";

$fp=@fsockopen("www.163.com","80",$errno,$errstr);

if($fp){

echo "ok";

fclose($fp);



}else{

echo "error:".$errstr;

}



?>


Copy the code. The result of executing the above code on the US space is:
error:Connection refused
ok

The execution result in the home space is:
ok
ok

Because I’m a good person, I don’t dare to guess whether it’s because of the server or 163
I hope you guys can help me explain
Thank you

Let me answer


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632561.htmlTechArticleProblems about fsockopen When I used fsockopen to write and send emails today, I found a strange problem. The following is the code: $fp= @fsockopen("smtp.163.com","25",$errno,$errstr); if($fp){ echo "ok...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn