有关php socket 的编程 http://www.phpe.net/manual/ref.sockets.php 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php$cfgServer = "your host"; //主机名或IP$cfgPort = 80; //监听端口号$cfgTimeOut = 10; //超时时间//open a socket if(!$cfgTimeOut) $usenet_handle = fsockopen($cfgServer, $cfgPort); else $usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); if(!$usenet_handle){ echo "Connection failed.\n"; exit(); } else{ echo "Connected.\n"; $tmp = fgets($usenet_handle, 1024); }?> 其實, 與 Server 端是甚麼語言是無關的,只需要知道 Server 的端口號和使用的協議就好了 . IIS的unlink()没反应 如何能让PHP和CURL集成? include怎么引用别的地方的文件? open_basedir restriction in effect.问题 输入手机号码后,发验证码到手机,具体怎么操作? 请问php pdo 在select的时候怎么判断结果集为空? 那位分析过华酷论坛的源代码? 用cuteftp无法删除服务器中的文件怎么办? 网站繁体版问题 商城类网站的商品图片是怎样显示的 关于pear的问题 着个函数什么意思?
$cfgPort = 80; //监听端口号
$cfgTimeOut = 10; //超时时间//open a socket
if(!$cfgTimeOut)
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
$usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); if(!$usenet_handle)
{
echo "Connection failed.\n";
exit();
}
else
{
echo "Connected.\n";
$tmp = fgets($usenet_handle, 1024);
}?>
只需要知道 Server 的端口號和使用的協議就好了 .