| |

VerySource

 Forgot password?
 Register
Search
View: 672|Reply: 1

Everyone talk about this method XMLHTTP generates static category pages, and the homepage is okay, let's talk about, th

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-1 09:00:02
| Show all posts |Read mode
Apply the XMLHTTP method to import asp pages to generate statically:
program
'---------------
function getHTTPPage (url)
 dim Http
  set Http = server.createobject ("MSXML2.XMLHTTP")
  Http.open "GET", url, false
  Http.send ()
   if Http.readystate <> 4 then
    exit function
   end if
  getHTTPPage = bytesToBSTR (Http.responseBody, "GB2312")
  set http = nothing
   if err.number <> 0 then err.Clear
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
'---------------------
Sub makehtml ()
Dim rsa
Dim Url, Html
dim filename, fso, fout
Set fso = Server.CreateObject ("Scripting.FileSystemObject")
Set rsa = server.CreateObject ("adodb.recordset")
rsa.open "select house_class_id from house_class", conn, 3,2
do while Not rsa.eof

  Url = "http: //"&request.ServerVariables ("Server_NAME")&"/house/house.asp?id="&rsa("house_class_id") "
  Html = getHTTPPage (Url)
  filename = "list"&rsa ("house_class_id")&-1&".htm"
  Set fout = fso.CreateTextFile (server.mappath (""&filename&""))
  fout.Write html
 rsa.movenext
loop
rsa.close
 fout.close
 set fout = nothing
 set fso = nothing
 if err then
 err.Clear
 response.Write ("An error occurred!")
 else
 response.write ("<br> <font color = '# ff0000'> Page <font> successfully generated")
 'response.write ("<meta http-equiv =' refresh 'content =' 2; URL = / house / index.htm '>")
 end if
End Sub
Call makehtml ()
Is this method good? If you can, then you can also generate the homepage,
Everyone talk about the good or bad of this method.This method is not fast.
I learned to apply one:
<script> function onDownloadDone (downDate) {showImport.innerHTML = downDate} oDownload.startDownload ('ASP file address', onDownloadDone) </ script> This generates each page individually, but how to implement it
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-11 13:00:01
| Show all posts
The application you mentioned can only be used in IE, 8 is good. .

The efficiency of xmlhttp is 8 good

Only suitable for rapid development

If a hard indicator of efficiency is needed, alternative 8 is less

If you must do http, you can use socket, you can use inet

If there is .net can use webclient, you can use the output directly in render. . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list