<?
$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"; } ?>
|