Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Error handling Fsockopen错误处理,在我收到警告和页面停止加载更多内容的那一刻_Error Handling_Fsockopen - Fatal编程技术网

Error handling Fsockopen错误处理,在我收到警告和页面停止加载更多内容的那一刻

Error handling Fsockopen错误处理,在我收到警告和页面停止加载更多内容的那一刻,error-handling,fsockopen,Error Handling,Fsockopen,我有以下代码: $open_socket = fsockopen($host,$port,$errno,$errstr,30); if(!$open_socket){ echo "$errstr ($errno)<br />".$nl; }else{ fputs($open_socket,$xml); while(!feof($open_socket)){ $line = fgets($open_socket,128); $re

我有以下代码:

$open_socket = fsockopen($host,$port,$errno,$errstr,30);
if(!$open_socket){
    echo "$errstr ($errno)<br />".$nl;
}else{
    fputs($open_socket,$xml);
    while(!feof($open_socket)){
        $line = fgets($open_socket,128);
        $return_xml.= $line;
    }
    fclose($open_socket);
}
$open\u socket=fsockopen($host、$port、$errno、$errstr,30);
if(!$open_插座){
回显“$errstr($errno)
”$nl; }否则{ fputs($open_socket,$xml); 而(!feof($open_socket)){ $line=fgets($open_socket,128); $return\u xml.=$line; } fclose($open_socket); }
但如果没有连接,我会收到以下消息:

警告:fsocket

页面的其余部分是空白的,基本上我如何处理这个问题,我的页面将继续显示,并且只显示错误消息,而不是警告


谢谢

您可以通过拨打fsockopen来取消警告

$open_socket = @fsockopen($host,$port,$errno,$errstr,30);