แพ็คเกจส่วนประกอบ XMLHTTP ใน ASP
ฉันเขียนฟังก์ชั่นขโมยให้ความสนใจกับส่วนรหัสสีแดงและเพิ่มคนอื่น ๆ ด้วยตัวเอง!
FunctionPOSTHTTPPAGEFROM (HTTPURL, StRA, FromURL)
dimhttp
sethttp = server.createObject ("msxml2.xmlhttp"))
http.open "post", httpurl, false
http.setrequestheader "ความยาวเนื้อหา", len (stra) http.setrequestheader "เนื้อหา-เนื้อหา-"
พิมพ์ "," แอปพลิเคชัน/x-www-form-urlencoded "
http.setrequestheader "referer", fromurl
http.sendstra
ifhttp.readystate <> 4 จากนั้น
sethttp = ไม่มีอะไร
gethttppage = "$ false $"
exitfunction
endif
POSTHTTPPAGEFROM = BYTESTOBSTR (http.ResponseBody, "GB2312")) sethttp = ไม่มีอะไรเลย
iferr.number <> 0 แล้ว
err.lear
endif
endfunction
FunctionByTestobstr (Body, CSET)
dimobjstream
setObjstream = server.createObject ("adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open1d)
objstream.writebody
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readText
objstream.close
setObjstream = ไม่มีอะไร
endfunction