[其他]
GODADDY 形成的HTML 文件为什么空?
|
|
<%
Function createhtml(url,filename,path)
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.CreateTextFile(path)
strurl=url
strTmp = GetHTTPPage(trim(strurl))
MyTextFile.WriteLine(strTmp)
MytextFile.Close
response.write ""&filename&"<br>"
%>
<p align="center" style="font-family:'Alpida Unicode System';">形成成功 </p>
<%
Set MyFileObject=nothing
End function
Function getHTTPPage(url)
'On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,true
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>hata lik kuruldi </b></font></p>"
Err.Clear
End If
End Function
Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
本地形成成功了但是在GODADDY 空间上形成的是空白
如果
Function getHTTPPage(url)
'On Error Resume Next
去掉注释会报错 错误提示如下 :
error '80004005'
/HTML_hasil_kilix_sub.asp, line 22
就是问题在于 Http.open "GET",url,true
Http.open "GET",url,false 也一样
请高手弄一下 |
|
|
|
|
|
|
|
|
|
|
lwbo1987
发表于 2011-10-21 09:16:38
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
fghrty1
发表于 2011-10-21 15:57:44
|
显示全部楼层
读写权已经设置好的,并且可以形成HTML 页 但是空白,不知道啥原因,把函数里面的处理错误代码的注释部分去掉以后才报错 |
|
|
|
|
|
|
|
|
|
|
lwbo1987
发表于 2011-10-21 15:59:14
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
fghrty1
发表于 2011-10-23 20:48:32
|
显示全部楼层
filename="default.html"
url="http://www.xxx.com/index_html.asp"
path=server.mappath(".")&"\myhtml\"&filename
Call createhtml(url,filename,path)
谢谢大家!为了解决大家的问题我好几天弄了终于找出了GODADDY 形成HTML 文件 是空白 页面 的错误,
请大家注意 url="http://www.xxx.com/index_html.asp" 这一点 ,URL=" " 必须双引号 否则形成的就是空白
下面的是形成HTML 的具体代码
<%
Function createhtml(url,filename,path)
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.CreateTextFile(path,true,utf-8)
strurl=url
strTmp = GetHTTPPage(trim(strurl))
MyTextFile.WriteLine(strTmp)
MytextFile.Close
response.write ""&filename&"<br>"
%>
<p align="center" style="font-family:'Alpida Unicode System';">形成成功 </p>
<%
Set MyFileObject=nothing
End function
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>hata lik kuruldi </b></font></p>"
Err.Clear
End If
End Function
Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
url="http://www.xxx.com/"
请大家注意: url="http://www.xxx.com/index_html.asp" 这一点 ,URL=" " 必须双引号 否则形成的就是空白
%> |
评分
-
查看全部评分
|
|
|
|
|
|
|
|