当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP的ASP防火墙

PHP
我的论坛源代码(三)
我的论坛源代码(二)
杏林同学录(七)
杏林同学录(八)
我的论坛源代码(十)
我的论坛源代码(九)
杏林同学录(九)
支持oicq头像的留言簿(二)
支持oicq头像的留言簿(一)
一个简单实现多条件查询的例子
不用数据库的多用户文件自由上传投票系统(1)
模仿OSO的论坛(二)
簡繁体转换的class
从C/C++迁移到PHP:判断字符类型的函数
PHP编程之高级技巧:利用Mysql函数
让你同时上传 1000 个文件 (二)
一个好用的分页函数
php环境配置 php5 mysql5 apache2 phpmyadmin安装与配置
PHP编程中八种常见的文件操作方式
给初学PHP的5个入手程序

PHP的ASP防火墙


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 175 ::
收藏到网摘: n/a

<?
$ASPservername : 此变量必须有IP在
/etc/hosts文件内.
$ASPport : ASP文件服务器端口号.
$ASPpath : 在服务器端的ASP文件路径.
$ASPfile : ASP文件名
$ASPurlredirect : $ASP文件参数.
//设置变量
$ASPservername = "WEB_SQLSERVER";
$ASPport = 80;
$ASPpath = "/development/sqlserver/";
$ASPfile = "storedprocs.asp?";
$ASPurlredirect = "clienthostpage=".strstr($SCRIPT_NAME, "/");
//连接IIS/ASP服务器
$fp=fsockopen($ASPservername, $ASPport, &$errno, &$errstr);
if($fp) {
//GET模式到服务器
$sRequest = "GET ".$ASPpath.$ASPfile;
$sProtocol= " HTTP/1.0 \n\n";
if (!strlen(chop($QUERY_STRING))){
$httpget=$sRequest.$ASPurlredirect.$sProtocol;
} else {
$httpget=$sRequest.$QUERY_STRING.$sProtocol;
}
//从客户端发送请求到ASP文件
fputs($fp,$httpget);
//处理返回结果
while(!feof($fp)) {
$line=fgets($fp,128);
//显示ASP文件返回结果
if ($bTripped){
echo $line;
} else {
//处理IIS头信息
$bTripped=strstr(strtoupper($line), "<HTML>");
if ($bTripped) echo $line;
}
}
fclose($fp);
} else {
echo "$errstr ($errno)<br>\n";
}
?>