<%
Function GetPage(url)
’获得文件内容
dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False ‘, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
on error resume next
Url=http://www.lastidea.net要读取的页面地址
response.write "开始更新首页…"
wstr = GetPage(Url)
’response.write(wstr)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
’if not MyFile.FolderExists(server.MapPath("/html/")) then
’MyFile.CreateFolder(server.MapPath("/html/"))’
’end if
’要存放的页面地址
dizhi=server.MapPath("index.htm")
If (fs.FileExists(dizhi)) Then
fs.DeleteFile(dizhi)
End If
Set CrFi=fs.CreateTextFile(dizhi)
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
response.write "…<font color=red>更新完成!</font>"
%>
这是网上能搜到的转载最多的一段转换代码,但实际操作起来还是有些许困难,下面这段代码是鄙人从一位帅哥的空间上偶尔发现,小试了一下,哇靠,超爽,效果奇好,有兴趣的哥们不妨试试。(放在index.asp同一目录下,在IE中输入其地址,点击生成按钮,大功告成了就,哈哈……)
<%
filename="index.htm"
webContent=request.form("body")
if webContent<>"" then
set fileObject = Server.CreateObject("Scripting.FileSystemObject")
set fileOut = fileObject.CreateTextFile(server.mappath(filename))
fileOut.writeline webContent
fileOut.close
set fileOut=nothing
set fileObject=nothing
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function closewin()
{
window.close();
}
</script>
</head>
<body>
<center>
文件可以成功生成! <a onclick="closewin()" href="#">关闭窗口</a>
</center>
</body>
</html>
showHTML.asp 文件:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form action="createHTML.asp" method="post" >
<textarea name="body" cols="120" rows="30">
<!–#include file="index.asp"–>
</textarea>
<p/>
<input type="submit" value="生成 index.htm文件">
</form>
</body>
</html>
#广而告之:开微博,赢红包,还有无限充值卡等你拿,马上注册吧!
#好糠共享:史上第一个能安装ipa的ipa,安全快捷,超强体验!!
不行啊,也许我太笨,请教啊,盼回复
呃,俺也试试看……效果如何?