*********请教winsock问题********** 我用fputs($usenet_handle,"testtest");发送不行。请问该怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 今天接着问我用fputs($usenet_handle,"testtest");发送不行。请问该怎么写? fputs 应该可以的吧,试试 fwrite? <?php $cfgServer = "127.0.0.1"; $cfgPort = 81; $cfgTimeOut = 5; //open a socket if(!$cfgTimeOut) // without timeout $usenet_handle = fsockopen($cfgServer, $cfgPort); else // with timeout $usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); $a = gethostbynamel("localhost"); echo $a[0]; if(!$usenet_handle) { echo "Connection failed.\n"; fclose($usenet_handle); exit(); } else { echo "Connected.\n"; set_socket_blocking ($usenet_handle, false); fputs($usenet_handle,"testtest"); while (!feof($usenet_handle)) { $tmp=fgets ($usenet_handle, 256); echo $tmp; } fclose($usenet_handle); }?> php进行批量删除的实现,跪求各位前辈,高手,大侠帮忙看看啊,急!急!急! php隐藏按钮的做法 请问如何保存PHP页面的数值到本地磁盘??? 求一个文件上传和管理的程序 为什么用php处理大批udp接收到的数据时,只能有一台机器访问网页? 如何配置PHP+Mysql php文件问题 如何模拟(post方式)提交form带HIDDEN变量,并返回提交成功后的信息。 怎样让下拉菜单(设为MULTIPLE)中多个选项同时选中显示出来。 期待一个斑竹 对session变量的一点看法 如何实现网站在线用户之间的短信对话?
fputs($usenet_handle,"testtest");发送不行。请问该怎么写?
$cfgServer = "127.0.0.1";
$cfgPort = 81;
$cfgTimeOut = 5; //open a socket
if(!$cfgTimeOut)
// without timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
// with timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
$a = gethostbynamel("localhost");
echo $a[0];
if(!$usenet_handle)
{
echo "Connection failed.\n";
fclose($usenet_handle);
exit();
}
else
{
echo "Connected.\n";
set_socket_blocking ($usenet_handle, false);
fputs($usenet_handle,"testtest");
while (!feof($usenet_handle))
{
$tmp=fgets ($usenet_handle, 256);
echo $tmp;
}
fclose($usenet_handle);
}
?>