skij
asked on
Classic ASP: Write Binary PDF to File
The following code returns an error. I think the problem might be related to the fact that I am trying to retrieve and write a binary PDF file. No error is returned when I use this code to retrieve and write a text file.
<%
url = "https://www.cl.cam.ac.uk/~mgk25/ucs/UTF-8-Plan9-paper.pdf"
set pdfhttp = CreateObject("MSXML2.ServerXMLHTTP")
pdfhttp.open "POST", url, false
pdfhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
dim pdata
pdat = "x=1&y=2&z=3"
pdfhttp.send pdat
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(Server.MapPath(".") & "\Test.pdf", 2, True)
oTextFile.Write pdfhttp.responseText
oTextFile.Close
set oTextFile = nothing
set oFS = nothing
Response.Write(pdfhttp.responseText)
Response.End
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome!
ASKER