你用fsockopen函数试试吧,如果打不开会他的值是false
fsockopen(string hostname, int port, int [errno], string [errstr], int [timeout]);
$fp = fsockopen("php.wilson.gs", 80, &$errno, &$errstr, 10);
if(!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs($fp,"GET / HTTP/1.0\nHost: php.wilson.gs\n\n");
while(!feof($fp)) {
echo fgets($fp,128);
}
fclose($fp);
}
这是php手册上的例子,你改改就可以用了.
我也是新手,不对不要骂我
fsockopen(string hostname, int port, int [errno], string [errstr], int [timeout]);
$fp = fsockopen("php.wilson.gs", 80, &$errno, &$errstr, 10);
if(!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs($fp,"GET / HTTP/1.0\nHost: php.wilson.gs\n\n");
while(!feof($fp)) {
echo fgets($fp,128);
}
fclose($fp);
}
这是php手册上的例子,你改改就可以用了.
我也是新手,不对不要骂我
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货