ASP中多见
PHP中比较少的,大都靠刷新来完成的
PHP中比较少的,大都靠刷新来完成的
解决方案 »
- php生成二维条码之疑惑
- 抓取数据
- 请教关于用户与用户组的关联问题
- iframe的情况下,子窗口和父窗口之间通过url传递参数的问题
- php, mysql5, mysqli_close关闭链接, 如何判断为有效链接.
- CSDN是PHP开发的,呵,请大家看看
- 新手问题!
- 我想购买Lycos的LINUX安家型空间(300元/年),请问该空间怎样?是否稳定?有什么问题么?下午3点结贴
- 请各位大侠指教在FF下,如何提交表单啊?
- 在php中读入一个图片文件,然后传递给flash,flash作为一个图片显示出来,总是提示无法转换为 flash.utils.ByteArray
- PHP连接oracle,执行外部sql脚本的问题!
- 如何用php处理WebService返回的DataSet结果集?
function bot($msg = "小I")
{$msg = eregi_replace("FanBot","小I",$msg);
$msg = str_replace("小I","FanBot",$msg);
$msg = str_replace("小I","FanBot",$msg);$fp = fsockopen('www.xiaoi.com', '80', $errno, $errstr, $timeout = 10); $body = "messageText=".$msg."&botid=popup-bot";
$head = "Connection: close
<html>
<head>
<script src='bots/jscript/webmessenger.js'></script>
</head>
<body>
<form name=\"composeForm\" method=\"post\" action=\"engine.isp\">
<input name=\"font\" id=\"font\" type=\"hidden\" value=\"0\" />
<input name=\"bold\" id=\"bold\" type=\"hidden\" value=\"0\" />
<input name=\"italic\" id=\"italic\" type=\"hidden\" value=\"0\" />
<input name=\"underline\" id=\"underline\" type=\"hidden\" value=\"0\" />
<input name=\"fontColor\" id=\"fontColor\" type=\"hidden\" value=\"black\" />
<input name=\"messageText\" id=\"messageText\" type=\"hidden\" />
<input name=\"botid\" value=\"popup-bot\" type=\"hidden\" />
</form><textarea id=\"answer\"></textarea> <textarea id=\"answer\">";$foot = "</textarea>
<textarea id=\"nick\">你</textarea><body>
</html>
<script language=\"vbs\">
function getHexString(num)
hexStr = hex(num)
for i = 5 to len(hexStr) step -1
hexStr = \"0\" + hexStr
next
getHexString = \"#\" + hexStr
end function
</script>
<script>
function getRandomColor() {
var r = Math.random() * 256;
var g = Math.random() * 256;
var b = Math.random() * 256;
if ( r> 0x90 && g > 0x90 && b > 0x90) {
r = 0x90;
g = 0x90;
b = 0x90;
}
return getHexString((r<<16) | (g<<8) | (b<<0) );
}
var times = 0;
function wait() {
var conversation = parent.parent.conversationWindow;
if (!conversation.isInit()) {
if (times<2000) {
window.setTimeout(\"wait();\",500);
times++;
}
}
else {
var format = null;
format = new MessageFormat(\"\", \"10pt\", \"\", getRandomColor());
for (var i=1;i<answer.length;i++)
conversation.InsertMessageFrom1(\"\",\"小i机器人\", answer[i].innerText, format);
this.parent.textBox.disabled=false;
this.parent.textBox.focus();
//var head = this.parent.document.getElementById(\"head\");
//head.src = \"\";
}
}
wait();
</script>";
if(!$fp)
{
//error tell us
return "ERROR:$errstr ($errno)";
}
else
{ $send = "POST /engine.isp HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: www.xiaoi.com
Content-Length: ".strlen($body)."
Connection: close
Cache-Control: no-cache".$body; //send the server request
fputs($fp, $send . "\r\n\r\n"); //loop through the response from the server
$res = "";
while(!feof($fp)) {
$res .= fgets($fp, 4096);
}
//close fp - we are done with it
fclose($fp); $res = str_replace($head,"",$res);
$res = str_replace($foot,"",$res); $res = str_replace("小I","FanBot",$res);
$res = str_replace("小I","FanBot",$res); $ret = explode("\n",$res,9); return $ret[8];
}
}
?>
如果要这个,PHP可以写。如果加上词法及语意分析的,用PHP不适合。需要写推理机,及自学习功能。