这是我的代码:
$fp = fsockopen("74.63.172.37", 22, $errno, $errstr, 50);
if (!$fp) {
echo "not connected";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: 74.63.172.37\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$val = "";
if (!feof($fp)) {
echo "<br/>".fgets($fp, 128);
}
if (feof($fp)) {
echo "<br/>Not connected";
} else {
echo "<br/>Connected";
}
fclose($fp);
die();
}
在本地服务器上,它给了我一个输出:
trying to connect
SSH-2.0-1.82_sshlib GlobalSCAPE
Connected
而在服务器上它给了我一个输出:
trying to connect
Not connected
我有另一个 sftp 服务器,我可以从服务器和本地连接。可能是什么问题?